#include<cstdio>
int main() {
    int n;
    int arr[10];
    arr[0] = 1;
    for (int  i = 1 ; i <= 10 ; ++i) {
        arr[i] = arr[i - 1] * i;
    }
    while (scanf("%d", &n) != EOF) {
        if (n == 0) {
            printf("NO\n");
        } else {
            for (int i = 10 ; i >= 0; --i) {
                if (n >= arr[i]) {
                    n -= arr[i];
                }
            }
            if ( n == 0) {
                printf("YES\n");
            } else {
                printf("NO\n");
            }
        }
    }
}