#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, j;
  bool ansflag = true;
  cin >> n;
  vector<long long> a(n + 3, 0);
  string anstr(32, '9');
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  a[0] = a[n];
  a[n + 1] = a[1];
  for (i = 1; i <= n; i++) {
    std::string str1(
        std::bitset<32>(a[i - 1])
            .to_string<char, std::char_traits<char>, std::allocator<char> >());
    std::string str2(
        std::bitset<32>(a[i])
            .to_string<char, std::char_traits<char>, std::allocator<char> >());
    std::string str3(
        std::bitset<32>(a[i + 1])
            .to_string<char, std::char_traits<char>, std::allocator<char> >());
    for (j = 31; j >= 0; j--) {
      if (str1[j] != str3[j]) {
        anstr[j] = '1';
      } else {
        anstr[j] = '0';
      }
    }
    if (anstr != str2) {
      ansflag = false;
      break;
    }
  }
  if (ansflag) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
