#include <bits/stdc++.h>
using namespace std;
struct HUT {
  long long Number;
  int size;
};
long long exor(long long a, long long b) {
  long long n = 1;
  long long ans = 0;
  while (1) {
    if (a % 2 != b % 2) {
      ans += n;
    }
    a /= 2;
    b /= 2;
    n *= 2;
    if (a == 0 && b == 0) break;
  }
  return ans;
}
int main() {
  int N;
  cin >> N;
  vector<HUT> hut;
  long long inp;
  for (int i = 0; i < N; i++) {
    cin >> inp;
    int flag = 0;
    for (int j = 0; j < hut.size(); j++) {
      if (hut.at(j).Number == inp) {
        hut.at(j).size++;
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      HUT appnd;
      appnd.size = 1;
      appnd.Number = inp;
      hut.push_back(appnd);
    }
    if (hut.size() >= 4) {
      cout << "No";
      return 0;
    }
  }
  string ans = "Yes";
  if (hut.size() != 3) {
    if (hut.size() == 1) {
      if (hut.at(0).Number == 0) {
        cout << "Yes";
        return 0;
      }
    } else {
      if (hut.at(0).Number == 0 && hut.at(1).Number == 1) {
        if (hut.at(0).size == N / 3) {
          cout << "Yes";
          return 0;
        }
      } else if (hut.at(0).Number == 1 && hut.at(1).Number == 0) {
        if (hut.at(1).size == N / 3) {
          cout << "Yes";
          return 0;
        }
      }
    }
    ans = "No";
  } else if (hut.at(1).size != hut.at(2).size ||
             hut.at(2).size != hut.at(0).size) {
    ans = "No";
  } else if (exor(hut.at(0).Number, hut.at(1).Number) != hut.at(2).Number) {
    ans = "No";
  }
  cout << ans;
  return 0;
}
