How many ways are there to write $657$ as a sum of powers of two, where each power of two is used at most twice in the sum? For example, $256 + 256 + 128 + 16 + 1$ is a valid sum.

Let's think step by step and output the final answer within \boxed{}.
user