#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
using pint = pair<long long, long long>;
long long dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  long long n;
  cin >> n;
  vector<long long> a(n + 2);
  for (long long i = 0; i < n; i++) cin >> a[i];
  a[n] = a[0];
  a[n + 1] = a[1];
  for (long long i = 1; i < n + 1; i++) {
    if ((a[i - 1] ^ a[i + 1]) != a[i]) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
}
