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