#include <bits/stdc++.h>
using namespace std;
int two(int t) {
  int ans = 0;
  for (int i = 0; t > 0; i++) {
    ans = ans + (t % 2) * pow(10, i);
    t = t / 2;
  }
  return ans;
}
int main() {
  int n, c = 0;
  long long int a[100001];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    a[i] = two(a[i]);
  }
  for (int i = 0; i < n - 2; i++) {
    if ((a[i] ^ a[i + 2]) == a[i + 1]) c += 1;
  }
  if ((a[0] == (a[n - 1] ^ a[1])) && ((a[n - 1] == a[0]) ^ a[n - 2])) c += 2;
  if (c == n)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
