#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m = 0, a, b[10];
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a;
    bool ok = false;
    for (int j = 1; j <= m; ++j)
      if (a == b[j]) {
        ok = true;
        break;
      }
    if (!ok) b[++m] = a;
    if (m > 3) break;
  }
  for (int i = 1; i < m; ++i)
    for (int j = i + 1; j <= m; ++j)
      if (b[i] > b[j]) swap(b[i], b[j]);
  if (m > 3)
    cout << "NO";
  else {
    bool ok = true;
    int j = b[2] - b[1];
    for (int i = 2; i <= m; ++i)
      if (b[i] - b[i - 1] != j) {
        ok = false;
        break;
      }
    if (ok)
      cout << "YES";
    else
      cout << "NO";
  }
  return 0;
}
