func_code_string: #include <bits/stdc++.h>   using namespace std;   using namespace std;   const int MaxN = 100005, NA = -1, MaxC = 0x3F3F3F3F;   int a[MaxN];   int n;   multiset<int, greater<int> > s;   deque<int> d;   int main(void) {     int i, v;     multiset<int>::iterator it;     while (scanf(  %d , &n) != EOF) {       for (i = 0; i < n; i++) scanf(  %d , &a[i]);       s.clear();       for (i = 0; i < n; i++) s.insert(a[i]);       d.clear();       it = s.begin();       d.push_back(*it);       s.erase(it);       for (i = 1; i < n; i++)         if (d.front() > d.back()) {           v = d.front();           it = s.find(v + 1);           if (it != s.end()) {             d.push_front(*it);             s.erase(it);           } else {             it = s.find(v - 1);             if (it != s.end()) {               d.push_front(*it);               s.erase(it);             } else               break;           }         } else {           v = d.back();           it = s.find(v + 1);           if (it != s.end()) {             d.push_back(*it);             s.erase(it);           } else {             it = s.find(v - 1);             if (it != s.end()) {               d.push_back(*it);               s.erase(it);             } else               break;           }         }       if ((int)d.size() == n && abs(d.front() - d.back()) == 1)         printf( YES n );       else         printf( NO n );     }     return 0;   }   