#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using i64 = int64_t; using i32 = int32_t; template void init_n(vector& v, size_t n, U x) { v = vector(n, x); } template void init_n(vector& v, size_t n) { init_n(v, n, T()); } template void read_n(vector& v, size_t n, size_t o = 0) { v = vector(n+o); for (size_t i=o; i> v[i]; } template void read_n(T a[], size_t n, size_t o = 0) { for (size_t i=o; i> a[i]; } template T gabs(const T& x) { return max(x, -x); } #define abs gabs i64 f(i64 x) { i64 y = 0; for (; x > 0; x >>= 1) y += x; return y; } int main() { i64 n; cin >> n; if (n == 0) { cout << "YES\n"; return 0; } i64 l = 0, r = 2 * n; while (r - l >= 2) { i64 x = l + (r - l) / 2; i64 y = f(x); if (y < n) l = x; else if (y > n) r = x; else { cout << "YES\n"; return 0; } cerr << x << '\t' << y << endl; } cout << "NO\n"; return 0; }