#include <bits/stdc++.h>
using namespace std;
bool nt(long long n) {
if (n <= 1) return false;
if (n == 2 || n == 3) return true;
if (n % 2 == 0 || n % 3 == 0) return false;
for (long long i = 5; i * i <= n; i += 6) {
if (n % i == 0 || n % (i + 2) == 0) return false;
}
return true;
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
long long n; cin >> n;
cout << (nt(n) ? "YES" : "NO");
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpib29sIG50KGxvbmcgbG9uZyBuKSB7CiAgICBpZiAobiA8PSAxKSByZXR1cm4gZmFsc2U7CiAgICBpZiAobiA9PSAyIHx8IG4gPT0gMykgcmV0dXJuIHRydWU7CiAgICBpZiAobiAlIDIgPT0gMCB8fCBuICUgMyA9PSAwKSByZXR1cm4gZmFsc2U7CiAgICBmb3IgKGxvbmcgbG9uZyBpID0gNTsgaSAqIGkgPD0gbjsgaSArPSA2KSB7CiAgICAgICAgaWYgKG4gJSBpID09IDAgfHwgbiAlIChpICsgMikgPT0gMCkgcmV0dXJuIGZhbHNlOwogICAgfQogICAgcmV0dXJuIHRydWU7Cn0KCmludCBtYWluKCkgewogICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7IGNpbi50aWUobnVsbHB0cik7IGNvdXQudGllKG51bGxwdHIpOwogICAgbG9uZyBsb25nIG47IGNpbiA+PiBuOwogICAgY291dCA8PCAobnQobikgPyAiWUVTIiA6ICJOTyIpOwogICAgcmV0dXJuIDA7Cn0K