#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
using ll = long long;
using ull = unsigned long long;
using namespace std;

int N;
int x[1000000];

void solve()
{
    cin >> N;
    rep(i,N) cin >> x[i];
    sort(x, x+N);
    reverse(x, x+N);

    int sub = x[0] - x[1];
    bool f = true;
    REP(i,2,N) {
        if(x[i-1] - x[i] != sub || x[i-1] - x[i] == 0) {
            f = false;
            break;
        }
    }
    cout << (f == true ? "YES" : "NO") << endl;
}

int main(){cin.tie(0);ios_base::sync_with_stdio(false);solve();return 0;}