#include using namespace std; int main() { int n; cin >> n; vector x(n); for (int i = 0; i < n; i++) cin >> x[i]; sort(x.begin(), x.end()); int d = x[1] - x[0]; if (d == 0) { puts("NO"); return 0; } for (int i = 2; i < n; i++) { if (x[i] - x[i - 1] != d) { puts("NO"); return 0; } } puts("YES"); }