#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 g=gcd(d,A[i+1]-A[i]); d/=g; sum+=(A[i+1]-A[i]); cnt++; } } } sum-=(cnt*d); sum/=d; if(sum<=zero){ cout << "Yes" << endl; } else{ cout << "No" << endl; } }