N = gets.to_i def f(x) s = 0 t = 0 n = x.bit_length (n).downto(0) do |i| t *= 2 t += 1 if x[i] == 1 s += t end s end ng = 10 ** 9 ok = 0 while (ok - ng).abs >= 2 x = (ok + ng) / 2 if f(x) <= N ok = x else ng = x end end if f(ok) == N puts 'YES' else puts 'NO' end