//#define _GRIBCXX_DEBUG #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; // 基本テンプレート #pragma region MACRO #define P(x) cout << (x) << endl #define p(x) cout << (x) #define PED cout << "\n" #define rep(i,n) for(int i=0; i<(int)n; ++i) #define REP(i,x,n) for(int i=x; i<(int)n; ++i) #define repi(i,n) for(int i=0; i<=(int)n; ++i) #define REPI(i,x,n) for(int i=x; i<=(int)n; ++i) #define ILP while(true) #define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i) #define ALL(c) (c).begin(), (c).end() #define mp make_pair #pragma endregion #pragma region TYPE_DEF typedef long long ll; typedef pair pii; typedef pair pss; typedef pair psi; typedef pair pis; typedef vector vi; typedef vector vd; typedef vector vl; typedef vector vll; typedef vector vs; #pragma endregion // Effective std #pragma region ESTD template constexpr int count(C& c, T t) { return count(ALL(c), t); } template constexpr int count_if(C& c, F f) { return count_if(ALL(c), f); } template constexpr void replace(C& c, T t, U u) { replace(ALL(c), t, u); } template constexpr void replace_if(C& c, F f, U u) { (ALL(c), f, u); } template constexpr void sort(C& c) { sort(ALL(c)); } template constexpr void sort(C& c, Pred p) { sort(ALL(c), p); } template constexpr void reverse(C& c) { reverse(ALL(c)); } #pragma endregion // 素数 #pragma region PRIME bool is_prime(unsigned n) { switch(n) { case 0: case 1: return false; case 2: return true; } if (n%2==0) return false; for (unsigned i=3; i*i<=n; i+=2) if (n%i==0) return false; return true; } #pragma endregion // 大文字/小文字変換 #pragma region TRANSFORM void mutal_tr(string &s) { for(int i=s.size(); i--;) { if(islower(s[i])) s[i] = toupper(s[i]); else if (isupper(s[i])) s[i] = tolower(s[i]); } } void to_upper(string &s) { for(int i=s.size(); i--;) s[i] = toupper(s[i]); } void to_lower(string &s) { for(int i=s.size(); i--;) s[i] = tolower(s[i]); } #pragma endregion // 集合 #pragma region SET template set intersection(const set& sa, const set& sb) { set ret; for(T a : sa) if(sb.find(a) != sb.end()) ret.insert(a); return ret; } #pragma endregion // Union Find #pragma region UF struct UnionFind { vector data; UnionFind(int size) : data(size, -1) {} bool union_set(int x, int y) { x = root(x); y = root(y); if(x!=y) { if(data[y] < data[x]) swap(x, y); data[x] += data[y]; data[y] = x; } return x != y; } bool find_set(int x, int y) { return root(x) == root(y); } int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); } int size(int x) { return -data[root(x)]; } }; #pragma endregion // 定数 #pragma region CONST_VAL #define PI (2*acos(0.0)) #define EPS (1e-9) #define MOD (int)(1e9+7) #pragma endregion int main() { int N; cin >> N; vi v; rep(i,N) { int x; cin >> x; v.push_back(x); } rep(i,N) { REP(j,i+1,N) { if(v[i]==v[j]) { P("NO"); return 0; } } } sort(v); int d = v[1] - v[0]; rep(i,N-1) { if(v[i+1]-v[i]!=d) { cout << v[i+1] << " " << v[i] << endl; P("NO"); return 0; } } P("YES"); return 0; }