#include <bits/stdc++.h>
using namespace std;
int find_xor(int x, int y) {
  int ans = 0, i;
  for (i = 31; i >= 0; i--) {
    bool x1 = x & (1 << i);
    bool y1 = y & (1 << i);
    bool compr = (x1 & y1) ? 0 : (x1 | y1);
    ans <<= 1;
    ans |= compr;
  }
  return ans;
}
int main() {
  int n, ck = 0;
  cin >> n;
  int ar[n];
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  for (int i = 0; i < n - 2; i++) {
    if (find_xor(ar[i], ar[i + 1]) == ar[i + 2]) {
      ck = 5;
    } else {
      ck = 0;
      break;
    }
  }
  if (ck == 5) {
    cout << "Yes";
    return 0;
  }
  for (int i = 0; i < n - 1; i++) {
    if (find_xor(ar[i], ar[n - 1 - i]) == ar[n - 2 - i]) {
      ck = 5;
    } else {
      cout << "No";
      return 0;
    }
  }
  if (ck == 5) {
    cout << "Yes";
    return 0;
  }
}
