#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  cin >> n;
  vector<long long> b;
  b.push_back(-1);
  int blen = 1;
  int kind = 0;
  int zero = 0;
  vector<long long> a(n, 0);
  for (int i = 0; i < n; ++i) {
    cin >> a.at(i);
    if (a.at(i) == 0) {
      zero++;
    }
    if (kind <= 3) {
      bool dub = false;
      for (int j = 0; j < blen; ++j) {
        if (b.at(j) == a.at(i)) {
          dub = true;
        }
      }
      if (!dub) {
        kind++;
        b.push_back(a.at(i));
        blen++;
      }
    }
  }
  if (kind == 1) {
    if (zero == n) {
      cout << "Yes" << endl;
      return 0;
    }
  } else if (kind == 2) {
    if (n % 3 == 0) {
      if (n / 3 == zero) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  } else if (kind == 3) {
    if (n % 3 == 0) {
      if (b.at(1) ^ b.at(2) ^ b.at(3) == 0) {
        int fst = 0;
        int snd = 0;
        int thd = 0;
        for (int i = 0; i < n; ++i) {
          if (a.at(i) == b.at(1)) {
            fst++;
          } else if (a.at(i) == b.at(2)) {
            snd++;
          } else {
            thd++;
          }
        }
        if (fst == snd && snd == thd && n / 3 == fst) {
          cout << "Yes" << endl;
          return 0;
        }
      }
    }
  }
  cout << "Yes" << endl;
}
