#include <bits/stdc++.h>
using namespace std;
string binary(int n) {
  string a = "";
  int bi = 1;
  while (bi <= n) {
    bi *= 2;
  }
  bi /= 2;
  while (bi != 0) {
    if (n >= bi) {
      n -= bi;
      bi /= 2;
      a = a + '1';
    } else {
      bi /= 2;
      a = a + '0';
    }
  }
  return a;
}
int main() {
  int n;
  cin >> n;
  vector<string> data;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    data.push_back(binary(a));
  }
  int max_keta = 0;
  for (int i = 0; i < data.size(); i++) {
    if (max_keta < data.at(i).size()) {
      max_keta = data.at(i).size();
    }
  }
  for (int i = 0; i < data.size(); i++) {
    while (max_keta != data.at(i).size()) {
      data.at(i) = '0' + data.at(i);
    }
  }
  int cnt = 0;
  for (int i = 0; i < data.size(); i++) {
    string now, front, back;
    now = data.at(i);
    if (i == 0) {
      front = data.at(data.size() - 1);
      back = data.at(i + 1);
    } else if (i == data.size() - 1) {
      back = data.at(0);
      front = data.at(i - 1);
    } else {
      front = data.at(i - 1);
      back = data.at(i + 1);
    }
    int cnt2 = 0;
    for (int j = 0; j < max_keta; j++) {
      if (now.at(j) == '0') {
        if (front.at(j) == '1' && back.at(j) == '1') {
          cnt2++;
        } else if (front.at(j) == '0' && back.at(j) == '0') {
          cnt2++;
        }
      } else if (now.at(j) == '1') {
        if (front.at(j) == '0' && back.at(j) == '1') {
          cnt2++;
        } else if (front.at(j) == '1' && back.at(j) == '0') {
          cnt2++;
        }
      }
    }
    if (cnt2 == max_keta) {
      cnt++;
    }
  }
  if (cnt == data.size()) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
