#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 233;
int a[maxn], vis[maxn], tot = 0;
int n;
bool check(int x) {
  int cnt = 0, id = 0;
  for (int i = 1; i <= n; i++)
    if ((a[i] & (1 << x)) == 0) {
      cnt++;
      id = vis[i];
    }
  if (cnt == n) return 1;
  if (cnt != n / 3) return 0;
  if (id == 0) tot++;
  for (int i = 1; i <= n; i++)
    if ((a[i] & (1 << x)) == 0) {
      if (vis[i] != id) return 0;
      if (vis[i] == 0) vis[i] = tot;
    }
  return 1;
}
int main() {
  cin >> n;
  if (n % 3) {
    puts("No");
    return 0;
  }
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < 30; i++)
    if (!check(i)) {
      puts("No");
      return 0;
    }
  puts("Yes");
  return 0;
}
