#include <bits/stdc++.h>
using namespace std;
int n;
int arr[100009];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 1; i < n - 1; i++) {
    int Xor = arr[i - 1] ^ arr[i + 1];
    if (Xor == arr[i]) continue;
    puts("NO"), exit(0);
  }
  if ((arr[1] ^ arr[n - 1]) != arr[0]) puts("NO"), exit(0);
  if ((arr[0] ^ arr[n - 2]) != arr[n - 1]) puts("NO"), exit(0);
  puts("YES"), exit(0);
}
