#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int A[N + 2];
  for (int i = (1); i <= (N); ++i) cin >> A[i];
  A[N + 1] = A[1];
  A[0] = A[N];
  bool CAN = true;
  for (int i = (1); i <= (N); ++i) {
    if (A[i - 1] ^ A[i + 1] != A[i]) CAN = false;
  }
  if (CAN)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
}
