#include <bits/stdc++.h>
int main() {
  long long int N, a[100000], count = 0, A[5], dig[30];
  std::cin >> N;
  for (int i = 0; i < N; i++) std::cin >> a[i];
  for (int i = 0; i < N; i++) {
    if (a[i] != 0) count++;
  }
  if (count == 0) {
    std::cout << "Yes" << std::endl;
    return 0;
  }
  count = 0;
  if (N % 3 != 0) {
    std::cout << "No" << std::endl;
    return 0;
  }
  std::sort(a, a + N);
  for (int i = 1; i < N; i++) {
    if (a[i - 1] != a[i]) {
      count++;
    }
  }
  if (count > 2) {
    std::cout << "No" << std::endl;
    return 0;
  }
  A[0] = a[0 * N / 3];
  A[1] = a[N / 3];
  A[2] = a[2 * N / 3];
  for (int i = 0; i < 30; i++) dig[i] = 0;
  for (int i = 0; i < 3; i++) {
    int j = 0;
    while (A[i] > 0) {
      if (A[i] % 2 == 1) dig[j]++;
      A[i] = A[i] / 2;
      j++;
    }
  }
  for (int i = 0; i < 30; i++) {
    if (dig[i] == 1 || dig[i] == 3) {
      std::cout << "No" << std::endl;
      return 0;
    }
  }
  std::cout << "Yes" << std::endl;
  return 0;
}
