#pragma GCC optimize("O3,unroll-loops") #include #include #include using namespace std; using namespace chrono; using namespace __gnu_pbds; #define ll long long int #define loop(a,b,i) for(long long int i=a;i=b;i--) #define cn continue; #define pb push_back #define db double #define mp make_pair #define sz(x) (ll)((x).size()) #define endl "\n" #define lb lower_bound #define ub upper_bound #define f first #define se second #define vll vector #define pll pair #define vpll vector< pair > #define all(x) x.begin(),x.end() #define print(a,n) for(ll i=0; i, null_type, less>, rb_tree_tag, tree_order_statistics_node_update > pbds; const ll inf = 1e18; const ll mod = 1e9 + 7; const ll MAX = 8000000000000000064LL; const ll MIN = -8000000000000000064LL; ll add(ll x, ll y) {ll res = x + y; return (res >= mod ? res - mod : res);} ll mul(ll x, ll y) {ll res = x * y; return (res >= mod ? res % mod : res);} ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + mod : res);} ll power(ll x, ll y) {ll res = 1; x %= mod; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;} ll mod_inv(ll x) {return power(x, mod - 2);} ll gcd(ll a,ll b) {if(b==0)return a; return gcd(b,a%b);} ll lcm(ll x, ll y) { ll res = x / gcd(x, y); return (res * y);} // ll nCr(ll n,ll r){ll ans=fact[n]; ans*=mod_inv(fact[n-r]);ans%=mod; ans*=mod_inv(fact[r]);ans%=mod; return ans;} const ll dx[] = {-1,1,0,0,1,1,-1,-1}; const ll dy[] = {0,0,1,-1,-1,1,-1,1}; bool isprime(ll n) { if(n<=1) return false; if(n==2) return true; if(n%2==0 and n!=2) return false; for(ll i=2;i<=sqrt(n);i++) if(n%i==0) return false; return true; } bool isPowerOfTwo(ll n){ if(n==0) return false; return (ceil(log2(n)) == floor(log2(n))); } signed main() { quick; // #ifndef ONLINE_JUDGE // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); // #endif int tc = 1; // cin >> tc; loop(0,tc,Q) { // cout << "Case #" << Q+1 << ": "; ll n; cin >> n; ll cnt = 0; vll v; unordered_map m; loop(0, n, i) { ll x; cin >> x; if(x == 0) cnt++; else { m[x]++; v.pb(x); } } if(sz(v) == 0) { cout << "Yes\n"; continue; } if(sz(v) == 1) { cout << "Yes\n"; continue; } sort(all(v)); ll diff = 0, g = -1; loop(1, sz(v), i) { diff = v[i] - v[i-1]; if(diff == 0) { g = 0; break; } else { if(g == -1) g = diff; else g = gcd(g, diff); } } if(g == 0) { if(sz(m) == 1) cout << "Yes\n"; else cout << "No\n"; continue; } ll res = ((v.back() - v[0]) / g) + 1 - (sz(v)); if(cnt < res) cout << "No\n"; else cout << "Yes\n"; } // cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl; return 0; }