#include using namespace std; int find_depth(int N){ int d = 1; while ((1 << d) - 1 <= N) ++d; return d - 1; } int calc_threshold(int t, int r){ return t * ((1 << r) - 1); } bool solve(int N){ if (N <= 1) return true; int D = find_depth(N); int t = 1; for (int d = 1; d < D; ++d){ N -= t; int left = 2 * t + 1; int threshold = calc_threshold(left, D - d); if (N == threshold) return true; if (N > threshold){ t = left; }else{ t = left - 1; } } return N == t; } int main(){ int N; cin >> N; cout << (solve(N) ? "YES" : "NO") << endl; return 0; }