#include <bits/stdc++.h>
using namespace std;
namespace FastIO_ {
template <typename T>
T read() {
  T x = 0;
  int f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return x * f;
}
template <typename T>
void _print(T x) {
  if (x > 9) _print(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
void print(T x, char c) {
  if (x < 0) putchar('-'), x = -x;
  _print(x);
  if (c) putchar(c);
}
}  // namespace FastIO_
namespace BIT_ {
template <typename T>
struct BIT {
  int Size;
  vector<T> Num;
  BIT<T>() { Size = 0; }
  BIT<T>(int S) { Num.resize((Size = S) + 5, 0); }
  void Update(T x, int pos) {
    for (int i = pos; i <= Size; i += (i & -i)) Num[i] += x;
  }
  T GetSum(int pos) {
    T ret = 0;
    for (int i = pos; i > 0; i -= (i & -i)) ret += Num[i];
    return ret;
  }
};
}  // namespace BIT_
namespace Math_ {
int Pow(long long x, long long y, int MOD) {
  int ret = 1;
  while (y) {
    if (y & 1) ret = ret * x % MOD;
    y >>= 1;
    x = x * x % MOD;
  }
  return ret;
}
void GetPrime(int N, vector<int> &Prime) {
  vector<int> vis;
  vis.resize(N + 5, 0);
  for (int i = 2; i <= N; i++) {
    if (!vis[i]) Prime.push_back(i);
    for (int j = 0; j < int(Prime.size()) && Prime[j] * i <= N; j++) {
      vis[Prime[j] * i] = 1;
      if (i % Prime[j] == 0) break;
    }
  }
}
template <typename T>
void Divide(T N, vector<pair<int, int> > &A, vector<int> Prime) {
  for (int i = 0; i < int(Prime.size()); i++) {
    int p = Prime[i], cnt = 0;
    while (N % p == 0) N /= p, cnt++;
    if (cnt) A.push_back(make_pair(p, cnt));
    if (N == 1 || Prime[i] * Prime[i] > N) break;
  }
  if (N > 1) A.push_back(make_pair(N, 1));
}
void GetFac(int N, int MOD, int *fac) {
  fac[0] = 1;
  for (int i = 1; i <= N; i++) fac[i] = (long long)fac[i - 1] * i % MOD;
}
void GetFac(int N, int MOD, int *fac, int *facInv) {
  GetFac(N, MOD, fac);
  facInv[N] = Pow(fac[N], MOD - 2, MOD);
  for (int i = N - 1; i >= 0; i--)
    facInv[i] = (long long)facInv[i + 1] * (i + 1) % MOD;
}
void GetC(int N, int **C, int MOD) {
  C[0][0] = 1;
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= i; j++)
      C[i][j] = ((long long)C[i - 1][j - 1] + (long long)C[i - 1][j]) % MOD;
}
int calC(int N, int M, int MOD, int *fac, int *facInv) {
  if (M > N) return 0;
  return (long long)fac[N] * facInv[N - M] % MOD * facInv[M] % MOD;
}
int calC(int N, int M, int MOD) {
  if (M > N) return 0;
  if (M > N - M) M = N - M;
  int ret = 1, cnt = 1;
  for (int i = N; i >= N - M + 1; i--)
    ret = (long long)ret * i / cnt % MOD, cnt++;
  return ret;
}
int calA(int N, int M, int MOD, int *fac, int *facInv) {
  if (M > N) return 0;
  return (long long)fac[N] * facInv[N - M + 1] % MOD;
}
int calA(int N, int M, int MOD) {
  if (M > N) return 0;
  int ret = 1;
  for (int i = N; i >= N - M + 1; i--) ret = (long long)ret * i % MOD;
  return ret;
}
}  // namespace Math_
namespace DSU_ {
struct DSU {
  vector<int> fa;
  DSU() {}
  DSU(int Size) {
    fa.resize(Size + 5, 0);
    for (int i = 1; i <= Size; i++) fa[i] = i;
  }
  int Find(int x) { return fa[x] == x ? x : fa[x] = Find(fa[x]); }
  bool Same(int x, int y) { return Find(x) == Find(y); }
  void Unite(int x, int y) { fa[Find(x)] = Find(y); }
  int Count(int N) {
    int ret = 0;
    for (int i = 1; i <= N; i++)
      if (Find(i) == i) ret++;
    return ret;
  }
};
}  // namespace DSU_
using namespace FastIO_;
int N, A[100000 + 5];
int main() {
  N = read<int>();
  for (int i = 1; i <= N; i++) A[i] = read<int>();
  sort(A + 1, A + N + 1);
  for (int i = 1; i <= N; i++)
    if (A[i] != A[(i + 2) % N + 1]) return puts("No");
  puts("Yes");
}
