#include <bits/stdc++.h>
using ll = long long int;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;
int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  for (int i = (int)0; i < (int)n; ++i) cin >> a[i];
  for (int i = 3; i < n; i += 3) {
    if (a[i] != a[i - 3]) {
      cout << "No\n";
      return 0;
    }
  }
  for (int i = 2; i < n; i += 3) {
    if (a[i + 1] != a[i - 2]) {
      cout << "No\n";
      return 0;
    }
  }
  for (int i = 1; i < n; i += 3) {
    if (a[i + 2] != a[i - 1]) {
      cout << "No\n";
      return 0;
    }
  }
  if (a[0] ^ a[2] != a[1]) {
    cout << "No\n";
    return 0;
  }
  cout << "Yes\n";
  return 0;
}
