#include <bits/stdc++.h>
using namespace std;
long long a[200000];
signed main() {
  long long n;
  bool ans = true;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 1; i < n - 1; i++) {
    for (long long j = 0; j < 9; j++) {
      long long x = a[i] >> (j + 1), y = a[i - 1] >> (j + 1),
                z = a[i + 1] >> (j + 1);
      if ((y + z) % 2 != x) ans = false;
    }
  }
  for (long long j = 0; j < 9; j++) {
    long long x = a[0] >> (j + 1), y = a[n - 1] >> (j + 1), z = a[1] >> (j + 1);
    if ((y + z) % 2 != x) ans = false;
  }
  for (long long j = 0; j < 9; j++) {
    long long x = a[n - 1] >> (j + 1), y = a[n - 2] >> (j + 1),
              z = a[0] >> (j + 1);
    if ((y + z) % 2 != x) ans = false;
  }
  if (ans)
    puts("Yes");
  else
    puts("No");
  return 0;
}
