#include<iostream> #include<vector> #include<bitset> #define maxn 100010 #define ll long long usingnamespacestd;
int p, n, a[maxn], b[maxn];
ll pow_mod(ll x, ll n){ ll s = 1; for (; n; n >>= 1, x = x * x % p) if (n & 1) s = s * x % p; return s; }
intget_g(int p){ int n = p - 1, tn = n; vector<int> vec; if (p == 2) return1; for (int p = 2; p * p <= tn; ++p) { if (tn % p) continue; vec.push_back(p); while (tn % p == 0) tn /= p; } if (tn > 1) vec.push_back(tn); for (int i = 2; i < p; ++i) { bool ok = 1; for (auto t : vec) if (pow_mod(i, n / t) == 1) ok = 0; if (ok) return i; } return-1; }
cin >> p; n = p - 1; for (int i = 1; i <= n; ++i) cin >> a[i], a[i] %= p; int g = get_g(p); b[0] = -1; for (int i = 0, t = 1; i < n; ++i) b[t] = i, t = 1ll * t * g % p; for (int i = 1; i <= n; ++i) a[i] = b[a[i]]; for (int i = 1; i <= n; ++i) { if (a[i] == -1) continue; f |= f << a[i] | f >> n - a[i]; f[a[i]] = 1; } cout << (f[0] ? "Yes" : "No") << "\n"; return0; }