#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto &x : a) cin >> x;
  bool ok = (a[n - 1] ^ a[0] == n);
  for (int i = 1; i < n && ok; i++) {
    ok &= (a[i - 1] ^ a[i] == n);
  }
  if (ok)
    puts("Yes");
  else
    puts("No");
}
