func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   bool uin(T &a, T b) {     return a > b ? (a = b, true) : false;   }   template <class T>   bool uax(T &a, T b) {     return a < b ? (a = b, true) : false;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     cout.precision(10);     cout << fixed;     int q;     cin >> q;     while (q--) {       int n;       cin >> n;       vector<vector<int> > occs(n);       for (int i = 0; i < (int)(n); ++i) {         int x;         cin >> x;         --x;         occs[x].push_back(i);       }       int dif = 0;       for (int i = 0; i < (int)(n); ++i)         if (!occs[i].empty()) ++dif;       int ch = 0, maxch = 0, R = -1;       for (int i = 0; i < (int)(n); ++i) {         if (occs[i].empty()) continue;         if (occs[i][0] > R)           ++ch, uax(maxch, ch);         else           ch = 1;         R = occs[i].back();       }       cout << dif - maxch <<   n ;     }     return 0;   }   