#include <bits/stdc++.h>
using namespace std;
char *p1, *p2, buffer[200000];
template <class T>
void read(T& x) {
  char ch = ((p1 == p2 &&
              (p2 = (p1 = buffer) + fread(buffer, 1, 200000, stdin), p1 == p2))
                 ? EOF
                 : *p1++);
  x = 0;
  bool f = 1;
  while (!('0' <= ch && ch <= '9') && ch != '-')
    ch = ((p1 == p2 &&
           (p2 = (p1 = buffer) + fread(buffer, 1, 200000, stdin), p1 == p2))
              ? EOF
              : *p1++);
  if (ch == '-')
    f = 0,
    ch = ((p1 == p2 &&
           (p2 = (p1 = buffer) + fread(buffer, 1, 200000, stdin), p1 == p2))
              ? EOF
              : *p1++);
  while ('0' <= ch && ch <= '9')
    x = (x << 3) + (x << 1) + ch - '0',
    ch = ((p1 == p2 &&
           (p2 = (p1 = buffer) + fread(buffer, 1, 200000, stdin), p1 == p2))
              ? EOF
              : *p1++);
  x = f ? x : -x;
}
set<int> s;
int n;
int a[100015];
int main() {
  read(n);
  for (register int i = 1; i <= n; i++) read(a[i]), s.insert(a[i]);
  if (s.size() > 3) {
    printf("No");
    return 0;
  } else {
    if (n % 3) {
      printf((s.size() == 1) ? "Yes" : "No");
      return 0;
    } else {
      if (s.size() == 1) {
        printf("Yes");
        return 0;
      } else if (s.size() == 3) {
        int x = *s.begin();
        s.erase(s.begin());
        int y = *s.begin();
        s.erase(s.begin());
        int z = *s.begin();
        s.erase(s.begin());
        if (x ^ y ^ z) {
          printf("No");
          return 0;
        } else {
          int cx = 0, cy = 0, cz = 0;
          for (register int i = 1; i <= n; i++) {
            if (a[i] == x)
              cx++;
            else if (a[i] == y)
              cy++;
            else
              cz++;
          }
          if (cx == cy && cy == cz) {
            printf("Yes");
            return 0;
          } else {
            printf("No");
            return 0;
          }
        }
      } else {
        int x = *s.begin();
        s.erase(s.begin());
        int y = *s.begin();
        s.erase(s.begin());
        if (x) {
          printf("No");
          return 0;
        }
        int cx = 0, cy = 0;
        for (register int i = 1; i <= n; i++) {
          if (a[i] == x)
            cx++;
          else
            cy++;
        }
        if (cy == (cx << 1)) {
          printf("Yes");
          return 0;
        } else {
          printf("No");
          return 0;
        }
      }
    }
  }
  return 0;
}
