#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  cin >> N;
  int a[N];
  int amax = 0;
  int a3[3];
  int b3[3];
  for (int i = 0; i < (int)(3); i++) {
    a3[i] = -1;
    b3[i] = 0;
  }
  string ans = "Yes";
  if (N % 3 > 0) {
    ans = "No1";
  }
  for (int i = 0; i < (int)(N); i++) {
    cin >> a[i];
    amax = max(a[i], amax);
    if (i == 0) {
      a3[0] = a[i];
      b3[0] += 1;
    } else if (a[i] != a3[0] && a3[1] < 0) {
      a3[1] = a[i];
      b3[1] += 1;
    } else if (a[i] != a3[0] && a[i] != a3[1] && a3[2] < 0) {
      a3[2] = a[i];
      b3[2] += 1;
    } else if (a[i] == a3[0]) {
      b3[0] += 1;
    } else if (a[i] == a3[1]) {
      b3[1] += 1;
    } else if (a[i] == a3[2]) {
      b3[2] += 1;
    } else {
      ans = "No2";
    }
  }
  if (a3[2] < 0) {
    a3[2] = a3[0];
  }
  if (b3[0] == b3[1] && b3[0] == b3[2]) {
  } else if (a3[0] == 0 && b3[0] * 2 == b3[1]) {
  } else if (a3[1] == 0 && b3[1] * 2 == b3[0]) {
  } else {
    ans = "No3";
  }
  int p = 1;
  int q;
  for (int i = 0; i < (int)(36); i++) {
    p = p * 2;
    if (amax <= p) {
      q = i + 2;
      break;
    }
  }
  int b[3][q];
  for (int i = 0; i < (int)(3); i++) {
    int pp = p;
    for (int j = 0; j < (int)(q); j++) {
      if (a3[i] >= pp) {
        b[i][j] = 1;
        a3[i] -= pp;
      } else {
        b[i][j] = 0;
      }
      pp = pp / 2;
    }
  }
  for (int i = 0; i < (int)(q); i++) {
    if ((b[0][i] + b[1][i]) % 2 != b[2][i]) {
      ans = "No4";
    }
  }
  if (amax == 0) {
    ans = "Yes";
  }
  cout << ans << endl;
  return 0;
}
