#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr ll mod = static_cast<ll>(1e9 + 7);
template <long long Mod = mod>
constexpr long long MOD(long long in) {
  return in % Mod;
}
template <class T>
constexpr T UP(T left, T div) {
  return (left + div - 1) / div;
}
int n;
ll a[100005];
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::cin >> n;
  ll biggest = 0;
  for (int i = 0; i < n; i++) {
    std::cin >> a[i];
    biggest = std::max(0LL, a[i]);
  }
  a[n] = a[0];
  biggest <<= 1;
  bool ans = true;
  for (ll d = 0; (1LL << d) <= biggest; d++) {
    ll zero = 0, one = 0;
    for (int i = 0; i < n; i++) {
      if (((a[i] >> d) & 1) == 1)
        one++;
      else
        zero++;
    }
    if (one == 0 || zero * 2 == one || zero * 2 == one - 1) {
      continue;
    }
    ans = false;
  }
  if (ans)
    std::cout << "Yes" << std::endl;
  else
    std::cout << "No" << std::endl;
  return 0;
}
