#include <bits/stdc++.h>
using namespace std;
string bitcheck(int a, int b, int c) {
  if (a != (b ^ c)) return "No";
  return "Yes";
}
int main() {
  int n;
  string check = "Yes";
  cin >> n;
  vector<int> num(n);
  for (int i = 0; i < n; ++i) cin >> num.at(i);
  for (int i = 0; i < n; ++i) {
    if (i == 0)
      check = bitcheck(num.at(i), num.at(i + 1), num.at(n - 1));
    else if (i == (n - 1))
      check = bitcheck(num.at(i), num.at(i - 1), num.at(0));
    else
      check = bitcheck(num.at(i), num.at(i - 1), num.at(i + 1));
    if (check == "No") break;
  }
  cout << check;
}
