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