#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, x, y, z;
  bool ans = true;
  cin >> n;
  int arr[n];
  for (i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (i = 0; i < n; i++) {
    x = i - 1;
    y = i;
    z = i + 1;
    if (i == 0)
      x = n - 1;
    else if (i == n - 1)
      z = 0;
    j = arr[x] ^ arr[z];
    if (j != arr[y]) ans = false;
  }
  ans ? cout << "Yes" : cout << "No";
  return 0;
}
