I was practicing for a programming competition and I got the following problem, which I was unable to solve:

It is given a number $N$. Find the amount of $x, y$ values, where $x > N$, $y < N$ and the amount of ones in binary form of $x$ and $ y$ is equal with the amount of ones in the binary form of $N$ ($x,y,N$ have the same number of digits in their binary form).

Thank you in advance.