#include // clang-format off using namespace std;constexpr int INF=1001001001;constexpr long long INFll=1001001001001001001;namespace viewer{template string f(T i){string s=(i==INF||i==INFll?"inf":to_string(i));s=string(max(0,3-int(s.size())),' ')+s;return s;} templateauto v(T&x,string end)->decltype(cerr<void v(const pair&p,string end="\n"){cerr<<"(";v(p.first,", ");v(p.second,")"+end);}templatevoid v(const tuple&t,string end="\n"){auto[a,b]=t;cerr<<"(";v(a,", ");v(b,")"+end);}templatevoid v(const tuple&t,string end="\n"){auto[a,b,c]=t;cerr<<"(";v(a,", ");v(b,", ");v(c,")"+end);}templatevoid v(const tuple&t,string end="\n"){auto[a,b,c,d]=t;cerr<<"(";v(a,", ");v(b,", ");v(c,", ");v(d,")"+end);} templatevoid v(const vector&vx,string);templateauto ve(int,const vector&vx)->decltype(cerr<auto ve(bool,const vector &vx){cerr << "{\n";for(const T&x:vx)cerr<<" ",v(x,",");cerr<<"}\n";}templatevoid v(const vector&vx, string){ve(0,vx);}templatevoid v(const deque&s,string e){vectorz(s.begin(),s.end());v(z,e);} templatevoid v(const set&s,string e){vectorz(s.begin(),s.end());v(z,e);}templatevoid v(const multiset&s,string e){vectorz(s.begin(),s.end());v(z,e);}templatevoid v(const unordered_set&s,string e){vectorz(s.begin(),s.end());v(z,e);}templatevoid v(const priority_queue&p,string e){priority_queueq=p;vectorz;while(!q.empty()){z.push_back(q.top());q.pop();}v(z,e);} templatevoid v(const map&m,string e){cerr<<"{"<<(m.empty()?"":"\n");for(const auto&kv:m){cerr<<" [";v(kv.first,"");cerr<<"] : ";v(kv.second,"");cerr<<"\n";}cerr<<"}"+e;}templatevoid _view(int n,string s,T&var){cerr<<"\033[1;32m"<void grid(T _){}void grid(const vector>&vvb){cerr<<"\n";for(const vector&vb:vvb){for(const bool&b:vb)cerr<<(b?".":"#");cerr<<"\n";}} void _debug(int,string){}templatevoid _debug(int n,string S,H h,T... t){int i=0,cnt=0;for(;iap;mint re=a;for(long long r=1;r>= __builtin_ctzll(a); do { b >>= __builtin_ctzll(b); if (a > b) swap(a, b); b -= a; } while (b); return a << common_factor; } template T gcd(vector &Xs) { T ret = (unsigned)abs(Xs[0]); for (T &x : Xs) ret = gcd(ret, (unsigned)abs(x)); return ret; } unsigned lcm(unsigned a, unsigned b) { return a / gcd(a, b) * b; } template T lcm(vector &Xs) { T ret = (unsigned)abs(Xs[0]); for (T &x : Xs) ret = lcm(ret, (unsigned)abs(x)); return ret; } int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; int cnt = 0; vector As; for (int i = 0; i < N; i++) { int a; cin >> a; if (a > 0) { As.push_back(a); } else { assert(a == 0); cnt++; } } vector AAs = As; sort(AAs.begin(), AAs.end()); AAs.erase(unique(AAs.begin(), AAs.end()), AAs.end()); if (AAs.size() != As.size()) { if (int(AAs.size()) == 1) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; } if (As.size() <= 2) { cout << "Yes" << endl; return 0; } sort(As.begin(), As.end()); vector Bs; for (int i = 0; i < int(As.size()) - 1; i++) { Bs.push_back(As[i + 1] - As[i]); } int g = gcd(Bs); assert(g != 0); for (int i = 0; i < int(Bs.size()); i++) { cnt -= (Bs[i] / g - 1); } cout << (cnt >= 0 ? "Yes" : "No") << endl; return 0; }