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

#define MAX_N 100'000

using namespace std;

int A[MAX_N];

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