#include <bits/stdc++.h>
int main() {
  int n;
  std::vector<int> aList;
  std::cin >> n;
  aList.resize(n);
  for (int i = 0; i < n; i++) std::cin >> aList[i];
  int maxNum = 0;
  for (int i = 0; i < n; i++) maxNum = std::max(aList[i], maxNum);
  int numDigit = 1;
  while (maxNum > 1) {
    numDigit = numDigit + 1;
    maxNum = maxNum / 2;
  }
  std::vector<std::vector<int>> bitList;
  bitList.resize(n);
  for (int i = 0; i < n; i++) bitList[i].resize(numDigit, 0);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < numDigit && aList[i] > 0; j++) {
      bitList[i][j] = aList[i] % 2;
      aList[i] = aList[i] / 2;
    }
  }
  bool isCorrect = true;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < numDigit; j++) {
      int prev = (n + i - 1) % n;
      int next = (n + i + 1) % n;
      if (bitList[prev][j] ^ bitList[next][j] != bitList[i][j])
        isCorrect = false;
    }
  }
  if (isCorrect)
    std::cout << "Yes" << std::endl;
  else
    std::cout << "No" << std::endl;
}
