#include <bits/stdc++.h>
using namespace std;
map<long long, long long> mp;
set<long long> s;
long long arr[666666];
signed main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> arr[i];
    mp[arr[i]]++;
    s.insert(arr[i]);
  }
  if (s.size() > 3)
    cout << "No";
  else {
    long long f = 1;
    map<long long, long long> vis;
    if (s.size() == 3) {
      for (long long i = 1; i <= n; i++) {
        if (!vis[arr[i]]) {
          if (mp[arr[i]] != n / 3) {
            f = 0;
            break;
          }
        }
        vis[arr[i]] = 1;
      }
    } else if (s.size() == 2) {
      if (mp[0] != n / 3) f = 0;
      for (long long i = 1; i <= n; i++) {
        if (!vis[arr[i]] && arr[i]) {
          if (mp[arr[i]] != 2 * n / 3) {
            f = 0;
            break;
          }
        }
        vis[arr[i]] = 1;
      }
    } else if (s.size() == 1) {
      if (mp[0] != n) f = 0;
    }
    if (f)
      cout << "Yes";
    else
      cout << "No";
  }
  return 0;
}
