#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
ll mod = 1000000007;
void yorn(bool a) {
  if (a)
    cout << "Yes";
  else
    cout << "No";
  cout << endl;
}
int main() {
  ll n;
  cin >> n;
  map<ll, ll> s;
  vll num(0);
  for (int i = 0; i < n; i++) {
    ll a;
    cin >> a;
    if (s.count(a))
      s[a]++;
    else {
      s[a] = 1;
      num.push_back(a);
    }
  }
  if (s.size() == 1) {
    yorn(num.at(0) == 0);
    return 0;
  }
  if (s.size() == 2) {
    yorn(n % 3 == 0 && s.count(0) && s[0] == n / 3);
    return 0;
  }
  if (s.size() == 3) {
    if (n % 3 != 0)
      yorn(0);
    else
      yorn(s[num.at(0)] == s[num.at(1)] && s[num.at(1)] == s[num.at(2)] &&
           num.at(0) ^ num.at(1) ^ num.at(2) == 0);
    return 0;
  }
  yorn(0);
}
