#include <bits/stdc++.h>
using namespace std;
bool SbS(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}
long long SUMD(long long n);
long long BS(vector<long long> &PS, long long s, long long e, long long ser);
long long MI(long long a, long long m);
bool P[100005];
void Sieve(int n = 100005);
int nCrModp(int n, int r, int p);
vector<long long> PF(long long n);
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  while (t--) {
    long long n, m, p, k, i, j, l, t1, r, u, x, y, a, b, c, d, q, flag, x1, x2,
        y1, y2;
    cin >> n;
    map<long long, long long> M;
    for (i = 0; i < n; i++) {
      cin >> x;
      M[x]++;
    }
    if (M.size() != 3) {
      cout << "No";
      return 0;
    }
    map<long long, long long>::iterator it = M.begin(), it1 = ++it, it2 = ++it1;
    if (it->second == (it1)->second and it1->second == (it2)->second) {
      if (it->first ^ (it1)->second == (it2)->second) {
        cout << "Yes";
        return 0;
      }
    }
    cout << "No";
    return 0;
  }
  return 0;
}
long long SUMD(long long n) {
  long long sum = 0;
  while (n > 0) {
    sum += n % 10;
    n = n / 10;
  }
  return sum;
}
long long BS(vector<long long> &PS, long long s, long long e, long long ser) {
  if (s > e) return s;
  long long mid = (s + e) / 2;
  if (PS[mid] == ser) {
    return mid;
  } else if (PS[mid] > ser) {
    return BS(PS, s, mid - 1, ser);
  } else
    return BS(PS, mid + 1, e, ser);
}
long long MI(long long a, long long m) {
  long long m0 = m;
  long long y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long q = a / m;
    long long t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
void Sieve(int n) {
  memset(P, true, sizeof(P));
  P[0] = false;
  P[1] = false;
  for (long long i = 2; i * i <= n; i++) {
    if (P[i]) {
      for (long long j = i * i; j <= n; j += i) {
        P[j] = false;
      }
    }
  }
}
int nCrModp(int n, int r, int p) {
  int C[r + 1];
  memset(C, 0, sizeof(C));
  C[0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = min(i, r); j > 0; j--) C[j] = (C[j] + C[j - 1]) % p;
  }
  return C[r];
}
vector<long long> PF(long long n) {
  vector<long long> pf;
  if (n % 2 == 0) {
    pf.push_back(2LL);
    n = n / 2;
    while (n % 2 == 0) n = n / 2;
  }
  for (long long i = 3; i <= sqrt(n); i += 2) {
    long long flag = 1;
    while (n % i == 0) {
      if (flag) {
        pf.push_back(i);
        flag = 0;
      }
      n = n / i;
    }
  }
  if (n > 2) pf.push_back(n);
  return pf;
}
