#include <bits/stdc++.h>
int main() {
  int N;
  scanf("%d", &N);
  int a[100000];
  int ab[100000][30];
  int fin = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 30; j++) {
      ab[i][j] = 0;
    }
  }
  for (int i = 0; i < N; i++) {
    scanf("%d", &a[i]);
    int temp = a[i];
    for (int j = 0; j < 30; j++) {
      if (temp % 2 == 1)
        ab[i][j] = 1;
      else
        ab[i][j] = 0;
      temp /= 2;
    }
  }
  for (int i = 0; i < N; i++) {
    if (i == 0) {
      for (int j = 0; j < 30; j++) {
        int temp2 = 0;
        if ((ab[N - 1][j] == 1 && ab[i + 1][j] == 0) ||
            (ab[N - 1][j] == 0 && ab[i + 1][j] == 1))
          temp2 = 1;
        if (ab[i][j] != temp2) {
          fin = 1;
          break;
        }
      }
    } else if (i == N - 1) {
      for (int j = 0; j < 30; j++) {
        int temp2 = 0;
        if ((ab[i - 1][j] == 1 && ab[0][j] == 0) ||
            (ab[i - 1][j] == 0 && ab[0][j] == 1))
          temp2 = 1;
        if (ab[i][j] != temp2) {
          fin = 1;
          break;
        }
      }
    } else {
      for (int j = 0; j < 30; j++) {
        int temp2 = 0;
        if ((ab[i - 1][j] == 1 && ab[i + 1][j] == 0) ||
            (ab[i - 1][j] == 0 && ab[i + 1][j] == 1))
          temp2 = 1;
        if (ab[i][j] != temp2) {
          fin = 1;
          break;
        }
      }
    }
    if (fin == 1) break;
  }
  if (fin == 1) printf("No");
  if (fin == 0) printf("Yes");
}
