#include <bitset>
#include <iostream>
#include <stdio.h>

#define MAX_N 100'000
#define MAX_A 1'000'000'000

using namespace std;

int A[MAX_N];

int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  for (int i = 0; i < N; ++i) {
    bitset<MAX_A> B0(A[(i + N - 1) % N]);
    bitset<MAX_A> B1(A[i]);
    bitset<MAX_A> B2(A[(i + 1) % N]);
    bitset<MAX_A> B = B0 ^ B2;
    if (B1 != B) {
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
}