#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, A[200000];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> A[i];
  int z = 1;
  for (int i = 0; i < n; i++)
    if (A[i] != ((A[(i - 1 + n) % n]) ^ (A[(i + 1) % n]))) z = 0;
  if (z)
    cout << "Yes";
  else
    cout << "No";
}
