#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    long long i, j, k, l, m, n;
    cin >> n;
    vector<long long int> v(n);
    for (long long int i = 0; i < n; i++) {
      cin >> v[i];
    }
    if ((v[0] ^ v[2]) != v[1]) {
      cout << "No";
      return 0;
    }
    for (i = 0; i < n; i++) {
      if (v[i] != v[(i + 3) % n]) {
        cout << "No";
        return 0;
      }
    }
    cout << "Yes";
  }
  return 0;
}
