func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 200000;   int c[MAXN + 10], d[MAXN + 10], l[MAXN + 10], r[MAXN + 10];   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n;     cin >> n;     vector<int> x(n);     for (int i = 0; i < n; ++i) {       cin >> x[i];       ++c[x[i]];     }     for (int i = 1; i <= MAXN; ++i) {       if (c[i] == 0) continue;       if (c[i] == 1) {         d[i] = 0;         l[i] = 1;       } else {         d[i] = c[i];         l[i] = d[i] + l[i - 1];       }     }     memset(d, 0, sizeof(d));     for (int i = MAXN; i >= 1; --i) {       if (c[i] == 0) continue;       if (c[i] == 1) {         d[i] = 0;         r[i] = 1;       } else {         d[i] = c[i];         r[i] = d[i] + r[i + 1];       }     }     int ans = 0, p = -1;     for (int i = 1; i <= MAXN; ++i) {       if (l[i] + r[i] - c[i] > ans) {         ans = l[i] + r[i] - c[i];         p = i;       }     }     if (ans == 1) {       for (int i = 1; i + 1 <= MAXN; ++i) {         if (c[i] > 0 && c[i + 1] > 0) {           cout << 2 << endl;           cout << i <<     << i + 1 << endl;           return 0;         }       }       cout << ans << endl;       cout << p << endl;       return 0;     }     vector<int> cir;     int q = p;     while (c[p] > 1) {       cir.push_back(p);       --c[p];       ++p;     }     while (p > q) {       while (c[p] > 0) {         cir.push_back(p);         --c[p];       }       --p;     }     cir.push_back(p);     --c[p];     --p;     while (c[p] > 1) {       cir.push_back(p);       --c[p];       --p;     }     while (p <= q) {       while (c[p] > 0) {         cir.push_back(p);         --c[p];       }       ++p;     }     cout << ans << endl;     for (int i : cir) cout << i <<    ;     cout << endl;     return 0;   }   