func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mxN = 210;   int n, a[mxN], pos[mxN][3];   int next(int i) {     if (pos[a[i]][0] == i) return pos[a[i]][1];     return pos[a[i]][0];   }   void upd(int u, int v) {     if (pos[a[u]][0] == u)       pos[a[u]][0] = v;     else       pos[a[u]][1] = v;   }   bool gd() {     for (int i = 1; i < 2 * n; i += 2) {       if (a[i] != a[i - 1]) return false;     }     return true;   }   void prnt() {     cout <<  Array  << endl;     for (int i = 0; i < 2 * n; i++) {       cout << a[i] <<    ;     }     cout << endl << endl;   }   int main() {     memset(pos, -1, sizeof pos);     cin >> n;     for (int i = 0; i < 2 * n; i++) {       cin >> a[i];       if (pos[a[i]][0] == -1)         pos[a[i]][0] = i;       else         pos[a[i]][1] = i;     }     int cnt = 0;     while (!gd()) {       for (int i = 0; i < 2 * n; i++) {         if (i + 1 < 2 * n && a[i] == a[i + 1]) continue;         if (i && a[i] == a[i - 1]) continue;         if (i + 1 < 2 * n && next(i) > i && next(i + 1) < next(i)) {           upd(i, i + 1);           upd(i + 1, i);           swap(a[i], a[i + 1]);           cnt++;         } else if (i && next(i) < i && next(i - 1) > next(i)) {           upd(i, i - 1);           upd(i - 1, i);           swap(a[i], a[i - 1]);           cnt++;         }       }     }     cout << cnt << endl;     return 0;   }   