#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int a[n];
  bool allzero = true;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] != 0) allzero = false;
  }
  bool pos = true;
  if (!allzero && n % 3) {
    cout << "No" << endl;
    return 0;
  }
  if (allzero) {
    cout << "Yes" << endl;
    return 0;
  }
  sort(a, a + n);
  int b = a[0], c = a[n - 1];
  if (b != 0) {
    int t = -1;
    int cnt1 = 0, cnt2 = 0, cnt3 = 0;
    if (c == b) pos = false;
    bool el = false;
    for (int i = 0; i < n; i++) {
      if (a[i] == b)
        cnt1++;
      else if (a[i] == c)
        cnt2++;
      else if (t == -1) {
        t = a[i];
        cnt3++;
      } else if (a[i] == t)
        cnt3++;
      else
        el = true;
    }
    if (el) pos = false;
    if (cnt1 != n / 3 || cnt2 != n / 3 || cnt3 != n / 3) pos = false;
    if (b != (c ^ t)) pos = false;
  } else {
    int cntzero = 0, cnt = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] == b)
        cntzero++;
      else if (a[i] == c)
        cnt++;
    }
    if (cnt != n / 3 || cntzero != (2 * n / 3)) pos = false;
  }
  if (pos)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
