#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int n;
int a[N], dig0[31], dig1[31];
int nd[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  if (count(a + 1, a + n + 1, 0) == n) {
    puts("Yes");
    return 0;
  }
  if (n % 3 != 0) {
    puts("No");
    return 0;
  }
  int lb = 1 << 30;
  for (int i = 1; i <= n; ++i) lb = min(lb, a[i] & -a[i]);
  int lbb = 0;
  while (lb != (1 << lbb)) ++lbb;
  int c0 = 0, c1 = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i] >> lbb & 1) {
      ++c1;
      for (int j = lbb + 1; j <= 30; ++j)
        if (a[i] >> j & 1) ++dig1[j];
    } else {
      ++c0;
      for (int j = lbb + 1; j <= 30; ++j)
        if (a[i] >> j & 1) ++dig0[j];
    }
  }
  if (c1 != c0 * 2) {
    puts("No");
    return 0;
  }
  int need = 0;
  for (int j = lbb + 1; j <= 30; ++j) {
    if (dig0[j] == 0) {
      if (dig1[j] != n / 3 * 2 && dig1[j] != 0) {
        puts("No");
        return 0;
      }
    } else if (dig0[j] == n / 3) {
      ++need;
      for (int i = 1; i <= n; ++i)
        if (!(a[i] >> lbb & 1))
          if (a[i] >> j & 1) ++nd[i];
    } else {
      puts("No");
      return 0;
    }
  }
  for (int i = 1; i <= n; ++i)
    if (nd[i] != 0 && nd[i] != need) {
      puts("No");
      return 0;
    }
  puts("Yes");
  return 0;
}
