#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  uint64_t first;
  uint64_t middle;
  uint64_t last;
  cin >> first >> middle >> last;
  uint64_t trueFirst = first;
  uint64_t trueSecond = middle;
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (middle == (first xor last)) {
      count++;
    }
    first = middle;
    middle = last;
    if (i == n - 3) {
      last = trueFirst;
    } else if (i > n - 3) {
      last = trueSecond;
    } else {
      cin >> last;
    }
  }
  if (count == n) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
