#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long n;
  cin >> n;
  string str[n + 2];
  bool ans = true;
  for (long long i = 1; i <= n; i++) {
    long long a;
    cin >> a;
    stringstream ss;
    ss << bitset<40>(a);
    str[i] = ss.str();
  }
  str[0] = str[n];
  str[n + 1] = str[1];
  for (long long i = 1; i <= n; i++) {
    string check;
    for (long long j = 0; j < str[i].length(); j++) {
      if (str[i - 1][j] == str[i + 1][j])
        check.push_back('0');
      else if (str[i - 1][j] != str[i + 1][j])
        check.push_back('1');
    }
    for (long long j = 0; j < str[i].length(); j++) {
      if (str[i][j] == check[j])
        check[j] = '0';
      else if (str[i][j] != check[j])
        check[j] = '1';
    }
    for (long long i = 0; i < check.length(); i++) {
      if (check[i] != '0') {
        ans = false;
        break;
      }
    }
  }
  if (ans == true)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
