#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int a[100010] = {0};
  int taf = 0;
  cin >> N;
  if (N == 1) cout << "Yes" << endl;
  if (N == 2)
    cout << "No" << endl;
  else if (N >= 3) {
    for (int i = 0; i < N; i++) cin >> a[i];
    sort(a, a + N);
    int b[3][2] = {0};
    for (int i = 0; i < N; i++) {
      if (i == 0) {
        b[0][0] = a[i];
        b[0][1] = 1;
      } else if (a[i] != b[0][0] && b[1][0] == 0) {
        b[1][0] = a[i];
        b[1][1] = 1;
      } else if (a[i] == b[1][0])
        b[1][1] += 1;
      else if (a[i] != b[1][0] && b[2][0] == 0) {
        b[2][0] = a[i];
        b[2][1] = 1;
      } else if (a[i] == b[2][0])
        b[2][1] += 1;
      else
        taf = 1;
    }
    if (b[0][0] != 0) {
      if (b[0][1] == b[1][1] == b[2][1])
        taf = taf;
      else
        taf = 1;
      if (b[0][0] ^ b[1][0] != b[2][0]) taf = 1;
    } else if (b[0][0] == 0) {
      if (b[2][0] != 0) taf = 1;
      if (b[0][1] * 2 != b[1][1]) taf = 1;
    }
    if (taf == 1)
      cout << "No" << endl;
    else if (taf == 0)
      cout << "Yes" << endl;
  }
}
