#include #include #define rep(i,a,b) for(int i=a;i=0;i--) #define rbit(i,a) for(int i=0;i<(1<bool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b; const ll mod=998244353; //const ll mod=1e9+7; int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; const string zton="0123456789"; const string atoz="abcdefghijklmnopqrstuvwxyz"; ll gcd(ll a,ll b){ ll r; r=a%b; if(r==0){ return b; } else{ return gcd(b,r); } } typedef pair P; int main(void){ int N;cin >> N; ll A[N]; int zero=0; map s; rep(i,0,N){ cin >> A[i]; if(A[i]==0)zero++; s[A[i]]=s[A[i]]+1; } for(auto p:s){ if(p.second>=2){ if(p.first==0)continue; if(s.size()==1){ cout << "Yes" << endl; return 0; } if(s.size()==2){ if(s.count(0)){ cout << "Yes" << endl; } else{ cout << "No" << endl; } return 0; } cout << "No" << endl; return 0; } } sort(A,A+N); ll d=-1; ll sum=0; ll cnt=0; rep(i,0,N-1){ if(A[i]!=0&&A[i]!=A[i+1]){ if(d==-1){ d=A[i+1]-A[i]; sum+=(A[i+1]-A[i]); cnt++; } else{ ll d=gcd(d,A[i+1]-A[i]); sum+=(A[i+1]-A[i]); cnt++; } } } if(d==-1){ cout << "Yes" << endl; return 0; } vector que; for(ll i=1;i*i<=d;i++){ if(d%i==0){ que.push_back(i); que.push_back(d/i); } } sort(all(que)); for(ll j:que){ ll ex=-1; bool f=true; rep(i,0,N){ if(A[i]==0)continue; if(ex==-1)ex=A[i]%j; if(ex!=A[i]%j){ f=false; break; } } if(f){ ll sum2=sum; sum2-=(cnt*j); sum2/=j; if(sum2<=zero){ cout << "Yes" << endl; return 0; } } else{ cout << "No" << endl; return 0; } } cout << "No" << endl; }