func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 10;   int a[N];   int sum[11];   int main() {     int n;     cin >> n;     for (int i = 1; i <= n; ++i) {       scanf( %d , &a[i]);       sum[a[i]]++;     }     while (1) {       int i, aa[11];       memset(aa, 0, sizeof(aa));       for (i = 1; i < 11; ++i) aa[i] = sum[i];       sort(aa, aa + 11);       for (i = 0; i < 11; ++i)         if (aa[i]) break;       if (aa[10] - aa[i] > 1) {         if (aa[i] == 1) {           if (aa[i + 1] == aa[10]) {             cout << n;             break;           }         }       } else if (aa[i] == aa[10]) {         if (aa[i] == 1 || i == 10) {           cout << n;           break;         }       } else {         if (aa[i] == 1) {           if (aa[i + 1] == aa[10]) {             cout << n;             break;           }         }         if (aa[i] == aa[9]) {           cout << n;           break;         }       }       sum[a[n]]--;       n--;     }     return 0;   }   