func main() var n: int :: cui@inputInt() var ans: int :: -1 for i(n - 100, n + 100) if(i <= 0) skip i end if if(f(i).xor(i $ bit64) = n $ bit64) do ans :: i break i end if end for do cui@print("\{ans}\n") func f(n: int): bit64 var res: int :: 0 while(n <> 0) if(n % 2 = 1) do res :+ 1 end if do n :/ 2 end while ret res $ bit64 end func end func