#include #define show(x) cerr << #x << " = " << x << endl using namespace std; using ll = long long; using ld = long double; constexpr ll MOD = 1000000007LL; template constexpr T INF = numeric_limits::max() / 10; template struct fix_type { Functor functor; template decltype(auto) operator()(Args&&... args) const& { return functor(functor, std::forward(args)...); } }; template fix_type::type> fix(Functor&& functor) { return {std::forward(functor)}; } int main() { ll N; cin >> N; if (N == 0) { cout << "YES" << endl; return 0; } for (ll i = 1, l = 2;; i++, l <<= 1) { const ll L = l - 1; const ll R = 2 * L - i; if (L > N) { break; } if (L <= N and N <= R) { cout << "YES" << endl; return 0; } } cout << "NO" << endl; return 0; }