#include <bits/stdc++.h>
using namespace std;
long long a[10010];
int n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%ld", &a[i]);
  a[0] = a[n];
  a[n + 1] = a[1];
  for (int i = 1; i <= n; i++) {
    int s = a[i - 1] ^ a[i + 1];
    if (s != a[i]) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
