#include <bits/stdc++.h>
using namespace std;
int n, ns[120000];
bool ans = true;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &ns[i]);
  ns[0] = ns[n];
  ns[n + 1] = ns[1];
  for (int i = 1; i <= n; i++)
    if ((ns[i - 1] ^ ns[i + 1]) != ns[i]) ans = false;
  if (ans)
    printf("Yes");
  else
    printf("No");
  system("pause");
  return 0;
}
