#include #define rep(i,a,n) for (int i = a;i < n;i++) #define per(i,n,a) for (int i = n-1;i >= a;i--) using namespace std; int main() { int n; cin >> n; vector x(n); rep(i,0,n) cin >> x[i]; sort(x.begin(),x.end()); int sa = x[1] - x[0]; if(sa == 0){ printf("NO\n"); return 0; } rep(i,1,n-1){ if(sa !=x[i+1] - x[i]){ printf("NO\n"); return 0; } } printf("YES\n"); return 0; }