#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long n;
  cin >> n;
  long long a[n + 1];
  string s[n + 1];
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i <= n; i++) {
    stringstream ss;
    if (i == n) {
      s[n] = s[0];
      break;
    }
    ss << bitset<45>(a[i]);
    s[i] = ss.str();
  }
  for (long long i = 0; i < n; i++) {
    string check;
    long long f = i - 1;
    long long l = i + 1;
    if (i == 0) f = n - 1;
    if (i == n - 1) l = 0;
    for (long long j = 0; j < s[i].length(); j++) {
      if (s[f][j] == s[l][j])
        check.push_back('0');
      else if (s[f][j] != s[l][j])
        check.push_back('1');
    }
    long long sum = 0, count = 0;
    for (long long i = check.length() - 1; i >= 0; i--) {
      if (check[i] == '1') sum += pow(2, count);
      count++;
    }
    if (sum != a[i]) {
      cout << "No" << endl;
      break;
    }
    if (i == n - 1) cout << "Yes" << endl;
  }
  return 0;
}
