#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
const long long LL_MAX = 9223372036854775807;
using namespace std;
long long a[1000005];
int main() {
  long long n;
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) scanf("%lld", &a[i]);
  a[0] = a[n], a[n + 1] = a[1];
  for (long long i = 1; i <= n; i++) {
    if ((a[i - 1] ^ a[i + 1]) != a[i]) {
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  return 0;
}
