#pragma GCC optimize("Ofast") #pragma GCC target("avx2") #define rd(v) long v=0;{long _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;} #define rep(v,e) for(long v=0;v>8|a[i]<<56; } } void radix_sort(ulong*a,int n){ static ulong b[200000]; radix_sort_aux(a,b,n); radix_sort_aux(b,a,n); radix_sort_aux(a,b,n); radix_sort_aux(b,a,n); radix_sort_aux(a,b,n); radix_sort_aux(b,a,n); radix_sort_aux(a,b,n); radix_sort_aux(b,a,n); } long gcd(long a,long b){ if(a==0||b==0){ return a+b; } long x=__builtin_ctzl(a); long y=__builtin_ctzl(b); a>>=x; b>>=y; long c; while(c=a-b){ c>>=__builtin_ctzl(c); if(c<0){ b=-c; }else{ a=c; } } return a<<(x<=y?x:y); } void yes() __attribute__((noreturn)); void yes(){ write(1,"Yes",3); _exit(0); } void no() __attribute__((noreturn)); void no(){ write(1,"No",2); _exit(0); } ulong a[200000]; int main(){ char*mmap(); char*rp=mmap(0l,1l<<25,1,2,0,0ll); rd(n); long l=0; while(*rp){ rd(x); if(x){ a[l++]=x; } } if(l<2){ yes(); } radix_sort(a,l); if(a[0]==a[l-1]){ yes(); } long g=a[l-1]-a[l-2]; rep(i,l-1){ g=gcd(g,a[i+1]-a[i]); } long m=n-1; rep(i,l-1){ long d=a[i+1]-a[i]; if(!d){ no(); } m-=d/g; } if(m<0){ no(); } yes(); }