#include int main(){ //s = 0, t = 0, t*2, t=t+1 | t=t, s=s+t //t: 1,2,4,8,16 = 31 //t: 1,2,4,8,17 = 32 //t: 1,2,4,9,18 = 34 //t: 1,2,4,9,19 = 35 //t: 1,2,5,10,20 = 38 //t: 1,2,5,10,21 //t: 1,2,5,11 //t: 1,2,5,11 //t: 1,3,6,12 //t: 1,3,6,12 //t: 1,3,6,13 //t: 1,3,6,13 //t: 1,3,7,14 //t: 1,3,7,14 //t: 1,3,7,15,30 //t: 1,3,7,15,31 // 2^0+2^1+2^2+2^3+2^4 ~ 2^0-1+2^1-1+2^2-1+2^3-1+2^4-1+2^5-1 // 2^5-1 ~ 2^6-1-6 long long N; scanf("%lld",&N); long long tleft=0,tright=1000000000; int found = 0; while(1){ if(tright-tleft < 0) break; long long t = (tleft+tright)/2; long long s = 0; long long tmp=t; while(tmp){ s += tmp; tmp = tmp/2;} if(s < N){ tleft = t+1; }else if(s == N){ found = 1; break; }else{ tright = t-1; } } printf("%s\n",found?"YES":"NO"); }