func_code_string: #include <bits/stdc++.h>   using namespace std;   map<int, int> mp;   int main() {     int n, num, flag = 1, f;     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d , &num);       ++mp[num];     }     map<int, int>::iterator it = mp.begin();     int ln = it->first;     int lm = it->second;     int l = ln, r = ln;     ++it;     for (; it != mp.end(); ++it) {       if (it->first > r + 1) {         flag = 0;         break;       } else {         if (lm == it->second) {           lm = 1;           r = it->first;         } else if (lm > it->second) {           lm -= it->second;           if (lm > 1) {             flag = 0;             break;           }         } else if (lm < it->second) {           if (l + 1 != it->first) {             lm = it->second - lm + 1;             r = it->first;             continue;           }           l = it->first;           r = it->first;           lm = it->second - lm;         }       }     }     if (l + 1 != r) flag = 0;     if (flag && lm < 2) {       printf( YES );     } else       printf( NO );     return 0;   }   