#include #include #include #include #include //--------------------------- using namespace std; //--------------------------- #define REP(i,n) for(int i = 0; i < (n); i++) #define P(x) cout << (x) << "\n" //--------------------------- int main(){ std::ios::sync_with_stdio(false); std::cin.tie(0); long n;cin>>n; vector v(n); REP(i,n){cin >> v[i];} sort(v.begin(),v.end()); if (v[1] -v[0] == 0) { P("NO"); }else{ REP(i,n - 1){ if (v[i+1]-v[i] != v[1]-v[0]) { P("NO"); break; }else if (i == n-2) { P("YES"); break; } } } return 0; }