#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  if (n == 3) {
    if (a[0] == a[1] ^ a[2]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else {
    vector<bool> v(n);
    for (int i = 0; i < n; ++i) {
      int c = i;
      while (!v[c]) {
        v[c] = true;
        if (a[c] != a[(c + 3) % n]) {
          cout << "No" << endl;
          return 0;
        }
        c = (c + 3) % n;
      }
    }
    if (a[0] ^ a[1] ^ a[2] == 0) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}
