#include #include int N; int *x; void read() { scanf("%d\n", &N); x = (int *)malloc(sizeof(int)*N); for (int i = 0; i < N; i++) { scanf("%d", &x[i]); } } int main() { read(); for (int i = N - 1; i >= 0; i--) { for (int j = 0; j < i; j++) { if (x[j] > x[j + 1]) { int k = x[j]; x[j] = x[j + 1]; x[j + 1] = k; } } } for (int i = 0; i < N - 1; i++) { if (x[i] == x[i + 1]) { printf("NO"); return 0; } } int width = x[1] - x[0]; if (N == 2) { printf("YES"); return 0; } for (int i = 2; i < N; i++) { if (x[i] - x[i - 1] != width) { printf("NO"); return 0; } } printf("YES"); return 0; }