func_code_string: #include <bits/stdc++.h>   using namespace std;   bool check(int x, int n, vector<int>& a) {     vector<int> temp;     int i = 0, j = x;     int cnt = 0;     bool ok = false;     while (cnt < n) {       if (ok)         temp.push_back(a[i]), i++, ok = false;       else         temp.push_back(a[j]), j++, ok = true;       cnt++;     }     cnt = 0;     return cnt == x;   }   void solve() {     int n;     cin >> n;     vector<int> a(n);     for (int i = 0; i < n; i++) cin >> a[i];     sort(a.begin(), a.end());     int cnt = 0;     vector<int> ans(n);     for (int i = 1; i < n; i += 2) {       ans[i] = a[cnt++];     }     for (int i = 0; i < n; i += 2) ans[i] = a[cnt++];     cnt = 0;     for (int i = 1; i < n - 1; i++) {       if (ans[i] < ans[i - 1] && ans[i] < ans[i + 1]) cnt++;     }     cout << cnt <<   n ;     for (int i = 0; i < n; i++) cout << ans[i] <<    ;   }   int main() {     ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);     ;     int t = 1;     while (t--) {       solve();       cout <<   n ;     }     return 0;   }   