#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const long double PI = acos((long double)-1);
inline long long gcd(long long a, long long b) {
  long long r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
inline long long fpow(long long n, long long k) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % MOD;
    n = n * n % MOD;
  }
  return r;
}
const int base = 311;
const int N = 1e5 + 5;
int a[N], n, m, x, k;
void Solve() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  a[0] = a[n];
  a[n + 1] = a[1];
  for (int i = 1; i <= n; i++) {
    if ((a[i - 1] ^ a[i + 1]) != a[i]) {
      cout << "No";
      exit(0);
    }
  }
  cout << "Yes";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  Solve();
  return 0;
}
