#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
  long long g = gcd(a, b);
  return a / g * b;
}
long long factorial(long long n) {
  long long t = 1;
  for (long long(i) = 1; (i) <= (n); ++(i)) t *= i;
  return t;
}
long long combinations(long long n, long long k) {
  long long r = 1;
  for (long long d = 1; d <= k; ++d) {
    r *= n--;
    r /= d;
  }
  return r;
}
int main() {
  long long n, x = 0, y = 0, z = 0;
  bool f = false, fx = false, fy = false, fz = false;
  cin >> n;
  map<long long, long long> m;
  for (long long(i) = 0; (i) < (n); ++(i)) {
    long long a;
    cin >> a;
    ++m[a];
    if (!fx) {
      x = a;
      fx = true;
    } else if (!fy && x != a) {
      y = a;
      fy = true;
    } else if (!fz && x != a && y != a) {
      z = a;
      fz = true;
    }
  }
  if (m[0] == n)
    f = true;
  else if (n % 3 == 0) {
    if (m[0] == n / 3 && m[y] == 2 * n / 3)
      f = true;
    else if (x ^ y ^ z == 0 && m[x] == n / 3 && m[y] == n / 3 && m[z] == n / 3)
      f = true;
  }
  cout << (f ? "Yes" : "No") << endl;
  return 0;
}
