#define _GLIBCXX_DEBUG #include #include//next_permutation #define rep(i,n) for (int i = 0;i < (n);i++) #define all(v) v.begin(),v.end() #define dec(n) cout << fixed << setprecision(n); #define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ" #define small "abcdefghijklmnopqrstuvwxyz" using namespace std; using ll = long long; using P = pair; using vl = vector; using vvl = vector; ll gcd(ll a,ll b){ if(b == 0) return a; return gcd(b , a % b); } const ll MOD = 1000000007; const ll MAX = 2000001; ll mod(ll a){ return a % MOD; } ll lcm(ll a,ll b){ return (a*b)/gcd(a,b); } vector> prime_factorize(ll n){ vector> res; for(ll i=2; i*i <= n; i++){ if(n % i != 0) continue; ll ex = 0; while(n % i == 0){ ex++; n /= i; } res.push_back({i,ex}); } if(n != 1) res.push_back({n,1}); return res; } int main(){ ll a; cin >> a; for(ll i=3; i <= a; i++){ if(i*(i+1)/2 > a){ cout << "NO" << endl; return 0; } if((a-i*(i+1)/2) % i == 0){ cout << "YES" << endl; return 0; } } cout << "NO" << endl; }