#include <iostream> #include <cstdint> using namespace std; using ull = unsigned long long; __int128_t pow(__int128_t a, __int128_t n, __int128_t m) { __int128_t x = a; __int128_t ret = 1ull; while (n) { if (n & 1ull) { ret *= x; ret %= m; } x *= x; x %= m; n = (n >> 1); } return ret; } bool MR(ull n, int k) { if (n == 2) return true; if (n%2==0) return false; if (n == 1) return false; int s = 1; while ((((n-1)>>s) & 1ull) == 0ull) s++; ull t = (n-1)>>s; for (int i=0;i<k;i++) { ull a = (ull)((double)rand()/RAND_MAX*(n-2))+1; __int128_t a_sq = pow(a, t, n); bool f = false; if (a_sq == 1) continue; for (int j = 0;j<s;j++) { if (a_sq == n-1) { f = true; break; } a_sq *= a_sq; a_sq %= n; } if (!f) return false; } return true; } int main( ){ ull x; cin >> x; int c = 0; while (!((x >> c) & 1ull)) { c++; } if ((x >> c) == ((1ull << (c+1))-1)) { if (MR((1ull<<(c+1))-1, 10)) { cout << "Yes"; } else { cout << "No"; } } else { cout << "No"; } }