#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[1000], n, i, j, count = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i != 1; i++) {
    if (a[i + 1] ^ a[n - 1] == a[i]) count++;
    break;
  }
  for (i = 1; i < n - 1; i++) {
    if (a[i - 1] ^ a[i + 1] == a[i]) {
      count++;
      break;
    }
  }
  for (i = n - 1; i < n; i++) {
    if (a[i - 1] ^ a[0] == a[i]) {
      count++;
      break;
    }
  }
  if (count == n)
    cout << "Yes";
  else if (count != n)
    cout << "No";
  return 0;
}
