typedef long long ll; typedef long double ld; #include using namespace std; #define int long long signed main(){ ll n; std::cin >> n; vector a; ll zc=0; for (int i = 0; i < n; i++) { ll tmp; std::cin >> tmp; if(tmp==0){ zc++; }else{ a.push_back(tmp); } } if(zc==n){ std::cout << "Yes" << std::endl; return 0; } bool same=false; sort(a.begin(),a.end()); vector dif; ll gcdv = 0; for (int i = 0; i < a.size()-1; i++) { if(a[i+1]-a[i]!=0){ gcdv = gcd(gcdv,a[i+1]-a[i]); dif.push_back(a[i+1]-a[i]); }else{ same=true; } } ll req = 0; for (auto e : dif) { req += e/gcdv-1; } if(same){ if(a.front()!=a.back()){ std::cout << "No" << std::endl; }else{ std::cout << "Yes" << std::endl; } }else{ if(req>zc){ std::cout << "No" << std::endl; }else{ std::cout << "Yes" << std::endl; } } }