#include <bits/stdc++.h> #define MAX 1000 using namespace std; int main(){ int dp[MAX];//vector<int> int n,i; dp[0] = 1; for(i = 1; i <= 10; i++) dp[i] = dp[i-1] * i; while(cin>>n){ for(i = 10;dp[i] > n; i--); for(;i >= 0; i--){ if(dp[i] <= n) n -= dp[i]; if(n == 0){ cout<<"YES"<<endl; break; } } if(n > 0 || i < 0) cout<<"NO"<<endl; } }