#include using namespace std; #define REP(i, n) for(int i = 0; i < n; i++) #define FOR(i, m, n) for(int i = m; i < n; i++) #define VSORT(v) sort(v.begin(), v.end()) int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector a(n); REP(i, n) cin >> a[i]; VSORT(a); int diff = a[1] - a[0]; if (diff == 0) { cout << "NO" << endl; return 0; } FOR(i, 2, n) { if (a[i] - a[i - 1] != diff) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }