#include using namespace std; using ll = long long; const ll mod = 1e9 + 7; const ll inf = (1 << 30) - 1; const ll infll = (1LL << 61) - 1; int n, d; int main() { cin >> n; vector a; for (int i = 0; i < n; i++) { int p; cin >> p; a.push_back(p); } bool f = 1; sort(a.begin(), a.end()); d = a[1] - a[0]; for (int i = 2; i < n; i++) { if (a[i - 1] + d!= a[i]) f = false; } cout << (f ? "YES" : "NO") << endl; }