#include using namespace std; const int N = (int) 1e5; int x[N]; int main() { ios::sync_with_stdio(false); int n; cin >> n; for (int i = 0; i < n; ++i) cin >> x[i]; sort(x, x + n); for (int i = 0; i + 1 < n; ++i) if (x[i + 1] - x[i] != x[1] - x[0]) return cout << "NO\n", 0; cout << (x[0] == x[1] ? "NO" : "YES") << endl; return 0; }