#include #include #include #include #include #include #include using namespace std; typedef long long ll; int N; int calc(int n){ int ans = 1; int tmp = 1; int d; if(n == 1) return 1; for(int i = 0; i <= 30; i++){ int m = 1< n) break; d = i; } for(int i = d; i >= 0; i--){ int m = 1<> N; if(N <= 1){ cout << "YES" << endl; return 0; } int l = 1, r = N; while(r-l > 1){ int c = (l+r)/2; if(calc(c) > N) r = c; else l = c; } if(calc(l) == N){ cout << "YES" << endl; }else{ cout << "NO" << endl; } }