#include #include #include using namespace std; int main() { int n, b, c; bool f = true; cin >> n; vector a(n); for (auto& e : a) cin >> e; sort(a.begin(), a.end()); int d = a[1] - a[0]; for (int i = 1; i < n - 1; i++) { if (a[i + 1] - a[i] != d) { f = false; break; } } if (d && f) cout << "YES" << endl; else cout << "NO" << endl; }