#include <bits/stdc++.h>
using namespace std;
vector<int> nishinsu(int x) {
  vector<int> A(30);
  for (int i = 0; i < 30; i++) {
    A.at(i) = x % 2;
    x /= 2;
  }
  return A;
}
vector<int> ronriwa(vector<int> x, vector<int> y) {
  vector<int> B(30);
  for (int i = 0; i < 30; i++) {
    B.at(i) = (x.at(i) + y.at(i)) % 2;
  }
  return B;
}
int main() {
  int N;
  cin >> N;
  vector<int> rakuda(N);
  for (int i = 0; i < N; i++) {
    cin >> rakuda.at(i);
  }
  bool OK = true;
  for (int i = 0; i < N; i++) {
    if (0 < i && i < N - 1) {
      vector<int> C = nishinsu(rakuda.at(i));
      vector<int> D =
          ronriwa(nishinsu(rakuda.at(i - 1)), nishinsu(rakuda.at(i + 1)));
      if (C != D) {
        OK = false;
      }
    } else if (i == 0) {
      vector<int> C = nishinsu(rakuda.at(i));
      vector<int> D =
          ronriwa(nishinsu(rakuda.at(N - 1)), nishinsu(rakuda.at(i + 1)));
      if (C != D) {
        OK = false;
      }
    } else {
      vector<int> C = nishinsu(rakuda.at(i));
      vector<int> D =
          ronriwa(nishinsu(rakuda.at(i - 1)), nishinsu(rakuda.at(0)));
      if (C != D) {
        OK = false;
      }
    }
  }
  if (OK) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
