#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int sz = 1 << 20;
const int inf = 2e9 + 7;
const int mod = 1e9 + 7;
const double pi = acos(-1);
int n, cnt[maxn], num[maxn];
set<int> s;
map<int, int> m;
int main() {
  scanf("%d", &n);
  int j = 1;
  for (int i = 1; i <= n; i++) {
    int t;
    scanf("%d", &t);
    if (!s.count(t)) {
      s.insert(t);
      m[t] = j;
      num[j++] = t;
    }
    cnt[m[t]]++;
  }
  if (s.size() != 3) {
    if (s.size() == 1 && num[1] == 0)
      printf("Yes\n");
    else if (s.size() == 2 && (num[1] == 0 || num[2] == 0)) {
      int t = (cnt[1] + cnt[2]) / 3;
      int a = m[0], b = m[0] == 1 ? 0 : 1;
      if (((cnt[a] - t) % 3 <= 1 && (cnt[b] - 2 * t) % 3 <= 1) ||
          ((cnt[b] - 2 * t) % 3 <= 2 && (cnt[a] - t) % 3 == 0))
        printf("Yes\n");
      else
        printf("No\n");
    } else
      printf("No\n");
  } else {
    if ((num[1] ^ num[3]) != num[2])
      printf("No\n");
    else {
      if ((cnt[1] / 3 != cnt[2] / 3) || (cnt[1] / 3 != cnt[3] / 3) ||
          (cnt[2] / 3 != cnt[3] / 3))
        printf("No\n");
      else {
        int t = (cnt[1] + cnt[2] + cnt[3]) / 3;
        if (((cnt[1] - t) % 3 > 1) || ((cnt[2] - t) % 3 > 1) ||
            ((cnt[3] - t) % 3 > 1))
          printf("No\n");
        else
          printf("Yes\n");
      }
    }
  }
  return 0;
}
