#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  string ans = "Yes";
  if (n % 3 != 0) {
    for (int i = 0; i < n; i++) {
      if (a[i] != 0) ans = "No";
    }
  } else {
    for (int i = 1; i < n - 1; i++) {
      if (a[i % 3] != a[(i + 1) % 3] ^ a[(i - 1) % 3]) ans = "No";
    }
    if (a[n - 1] != a[n - 1] ^ a[0] || a[0] != a[n - 1] ^ a[1]) ans = "No";
  }
  cout << ans << endl;
  return 0;
}
