#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template <typename T>
using Vec = vector<T>;
template <typename T>
bool inRange(T x, T lb, T ub) {
  return lb <= x && x < ub;
}
template <typename T>
bool inRange(T x, T y, T lb, T ub) {
  return in_range(x, lb, ub) && in_range(y, lb, ub);
}
template <typename T>
void modAdd(T& a, T b, T mod) {
  a = (a + b + mod) % mod;
}
template <typename T>
void modMul(T& a, T b, T mod) {
  a = (a * b) % mod;
}
template <typename T>
void minUpdate(T& a, T b) {
  a = min(a, b);
}
template <typename T>
void maxUpdate(T& a, T b) {
  a = max(a, b);
}
inline int bitCount(int x) { return __builtin_popcount(x); }
inline int bitCount(lint x) { return __builtin_popcountll(x); }
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1},
          Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
const double PI = acos(-1);
int main() {
  int N;
  cin >> N;
  if (N % 3 == 0) {
    map<int, int> cnt;
    for (int i = (0); i < (N); ++i) {
      int a;
      cin >> a;
      cnt[a]++;
    }
    if (cnt.size() == 1) {
      puts("Yes");
      return 0;
    }
    if (cnt.size() > 3) {
      puts("No");
      return 0;
    }
    Vec<int> v, t;
    for (auto it : cnt) {
      if (it.second > 0) {
        v.push_back(it.second);
        t.push_back(it.first);
      }
    }
    if (cnt.size() == 2) {
      if (v[0] == v[1] * 2 && t[1] == 0)
        puts("Yes");
      else if (v[1] == v[0] * 2 && t[0] == 0)
        puts("Yes");
      else
        puts("No");
    } else {
      if (v[0] == v[1] && v[1] == v[2]) {
        if ((t[0] ^ t[2]) == t[1] || (t[1] ^ t[0]) == t[2] ||
            (t[2] ^ t[1]) == t[0])
          puts("Yes");
        else
          puts("No");
      } else
        puts("No");
    }
  } else {
    bool isok = true;
    int a;
    cin >> a;
    for (int i = (1); i < (N); ++i) {
      int x;
      cin >> x;
      isok &= (x == a);
    }
    puts(isok ? "Yes" : "No");
  }
}
