#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int n, x = -1, y = -1, z = -1, p, q, r;
int main() {
  scanf("%d", &n);
  if (n < 3) {
    puts("Yes");
    return 0;
  }
  for (int i = 1; i <= n; ++i) {
    int a;
    scanf("%d", &a);
    if (a == x)
      p++;
    else if (a == y)
      q++;
    else if (a == z)
      r++;
    else if (x == -1)
      x = a, p = 1;
    else if (y == -1)
      y = a, q = 1;
    else if (z == -1)
      z = a, r = 1;
    else {
      puts("No");
      return 0;
    }
  }
  if (p != q || q != r) {
    puts("No");
    return 0;
  }
  if (x ^ y ^ z) {
    puts("No");
    return 0;
  }
  puts("Yes");
  return 0;
}
