#include <bits/stdc++.h>   using namespace std;   const int MOD = 1e9 + 7;   void no() {     cout <<  NO n ;     exit(0);   }   int main() {     int n;     cin >> n;     vector<int> arr(n);     for (int i = 0; i < n; ++i) cin >> arr[i];     sort(arr.begin(), arr.end());     for (int i = n - 1; i >= 0; --i) {       arr[i] -= arr[0];       if (arr[i] >= n) no();     }     vector<int> cnt(n);     for (int i = 0; i < n; ++i) cnt[arr[i]]++;     int mx = arr[n - 1];     for (int i = 1; i < mx; ++i) {       if (cnt[i] < 2) no();       cnt[i] -= 2;     }     cnt[0]--;     cnt[mx]--;     for (int i = 0; i <= mx; ++i) {       while (cnt[i] > 0) {         if (cnt[i + 1] == 0) no();         cnt[i]--;         cnt[i + 1]--;       }     }     cout <<  YES n ;   }   