#include <bits/stdc++.h>
using namespace std;
const double pi = 3.14159265358979323846264;
const int mod = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  int f = 1, var = 0;
  map<int, int> mp;
  for (int i = (0); i < (n); ++i) {
    cin >> v[i];
    if (v[i] != 0) f = 0;
    if (mp[v[i]] == 0) var++;
    mp[v[i]]++;
  }
  if (f) {
    cout << "Yes" << endl;
    return 0;
  }
  if (mp[0] != 0) {
    if (var != 2) {
      cout << "No" << endl;
      return 0;
    } else {
      int t = 0;
      for (auto x : mp) {
        if (x.first != 0) t = x.first;
      }
      if (mp[t] == mp[0] * 2) {
        cout << "YES" << endl;
      } else {
        cout << "No" << endl;
      }
      return 0;
    }
  } else {
    cerr << "test" << endl;
    if (var != 3) {
      cout << "No" << endl;
      return 0;
    } else {
      cerr << "test2" << endl;
      int lst[3] = {};
      int idx = 0, t = 0;
      for (auto x : mp) {
        if (x.first == 0) continue;
        lst[idx] = x.first;
        t = x.second;
        idx++;
      }
      for (auto x : mp) {
        if (x.first != 0 && x.second != t) {
          cout << "No" << endl;
          return 0;
        }
      }
      cerr << "test2" << endl;
      for (int i = (0); i < (31); ++i) {
        int cnt[2] = {};
        for (int j = (0); j < (3); ++j) {
          int tt = lst[j];
          cnt[(tt >> i) & 1]++;
        }
        if (cnt[1] == 0 || (cnt[0] * 2 == cnt[1])) {
        } else {
          cout << "No" << endl;
          return 0;
        }
      }
      cout << "Yes" << endl;
    }
  }
  return 0;
}
