#include <bits/stdc++.h>
using namespace std;
long long n, x, y, z;
long long a[100010];
map<long long, long long> mp;
signed main() {
  scanf("%lld", &n);
  if (n % 3 != 0) {
    cout << "No" << endl;
    return 0;
  }
  for (long long i = 0; i < (long long)(n); i++) {
    scanf("%lld", &a[i]);
    mp[a[i]]++;
  }
  sort(a, a + n);
  x = a[0], y = a[n / 3], z = a[n - 1];
  if (mp.size() == 1 && mp[x] == n) {
    cout << "Yes" << endl;
  } else if (mp.size() == 2 && x == 0 && y == z && mp[x] == n / 3) {
    cout << "Yes" << endl;
  } else if (true || mp.size() == 3 && (x xor y xor z) == 0 && x != y &&
                         y != z && x != z && mp[x] == mp[y] && mp[y] == mp[z] &&
                         mp[x] == n / 3) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
