#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  bitset<100000> value;
  cin >> n;
  vector<int> a(n);
  vector<bool> flag(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int j = 1; j < n; j++) {
    bitset<100000> xor_bits =
        bitset<100000>(a[j - 1]) ^ bitset<100000>(a[j + 1]);
    if (xor_bits == bitset<100000>(a[j]))
      flag[j] = true;
    else
      flag[j] = false;
  }
  bitset<100000> xor_bits = bitset<100000>(a[1]) ^ bitset<100000>(a[n]);
  if (xor_bits == bitset<100000>(a[0]))
    flag[0] = true;
  else
    flag[0] = false;
  bool ans = false;
  for (int k = 0; k < n; k++) {
    if (flag[k] == false) {
      ans = true;
      if (ans) break;
    }
  }
  if (ans)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
  return 0;
}
