#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using v = vector<ll>;
int main() {
  ll n;
  cin >> n;
  auto a = v(n, 0);
  for (auto &i : a) cin >> i;
  a.push_back(a[0]);
  a.push_back(a[1]);
  for (ll i = 1; i <= n; i++) {
    ll c = a[i - 1] ^ a[i] ^ a[i + 1];
    if (c == 0) continue;
    cout << "No";
    return 0;
  }
  cout << "Yes";
  return 0;
}
