#include <bits/stdc++.h>
using namespace std;
int n;
int a[10000005];
map<int, int> mp;
int main(int argc, const char* argv[]) {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    mp[a[i]] += 1;
  }
  for (auto i : mp) {
    if (i.second == n) {
      puts("Yes");
      return 0;
    }
    if (n % 3 != 0 || i.second % (n / 3) != 0) {
      puts("No");
      return 0;
    }
  }
  puts("Yes");
  return 0;
}
