#include int main(void) { int b, i, j, t, n, a[100000]; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &a[i]); for (i = 0; i < n - 1; i++) for (j = i + 1; j < n; j++) if (a[i] > a[j]) { t = a[i]; a[i] = a[j]; a[j] = t; } b = 0; t = a[1] - a[0]; for (i = 0; i < n - 1; i++) { if (a[i] == a[i + 1] || a[i + 1] - a[i] != t) { b = -1; break; } } if (b == 0) printf("YES\n"); else printf("NO\n"); return 0; }