#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<vector<int>> vbit;
  int tempmax = 0;
  for (int i = 0; i < n; i++) {
    if (tempmax < a[i]) {
      tempmax = a[i];
    }
  }
  int maxdigit = 0;
  if (tempmax == 0) {
    maxdigit = 1;
  } else {
    int temp = tempmax;
    while (temp > 0) {
      temp /= 2;
      maxdigit++;
    }
  }
  for (int i = 0; i < n; i++) {
    int temp = a[i];
    vector<int> emptyvector;
    vbit.push_back(emptyvector);
    for (int j = 0; j < maxdigit; j++) {
      int tempbit = temp % 2;
      vbit[i].push_back(tempbit);
      temp /= 2;
    }
  }
  bool allzero = true;
  for (int i = 0; i < n; i++) {
    if (a[i] != 0) {
      allzero = false;
      break;
    }
  }
  if (allzero) {
    cout << "Yes" << endl;
  } else if (n % 3 != 0) {
    cout << "No" << endl;
  } else {
    bool gooddigits = true;
    for (int j = 0; j < maxdigit; j++) {
      int temp = 0;
      for (int i = 0; i < n; i++) {
        temp += vbit[i][j];
      }
      if (temp != n * 2 / 3 && temp != 0) {
        gooddigits = false;
        break;
      }
    }
    if (!gooddigits) {
      cout << "No" << endl;
    } else {
      map<int, int> mp;
      for (int i = 0; i < n; i++) {
        if (mp.find(a[i]) == mp.end()) {
          mp.insert(make_pair(a[i], 1));
        } else {
          mp[a[i]]++;
        }
      }
      map<int, int>::iterator itr;
      set<int> st;
      for (itr = mp.begin(); itr != mp.end(); itr++) {
        pair<int, int> p = *itr;
        st.insert(p.second);
      }
      if (mp.size() == 3 && st.size() == 1) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
  }
  return 0;
}
