func_code_string: #include <bits/stdc++.h>   using namespace std;   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   int d4x[4] = {1, 0, -1, 0};   int d4y[4] = {0, 1, 0, -1};   int d8x[8] = {0, 1, 1, 1, 0, -1, -1, -1};   int d8y[8] = {1, 1, 0, -1, -1, -1, 0, 1};   const long long oo = 1e18;   const long long maxN = 1e6;   void maximize(int &a, int b) { a = max(a, b); }   void minimize(int &a, int b) { a = min(a, b); }   int cnt[15];   void solve() {     int n, ans = 0;     cin >> n;     for (int i = 1; i <= n; i++) {       int x;       cin >> x;       cnt[x]++;       int g = 0, b, d = 0;       b = n + 1;       for (int j = 1; j <= 10; j++) {         if (cnt[j] > 0) {           cnt[j]--;           int p = 0;           bool ok = true;           for (int k = 1; k <= 10; k++) {             if (cnt[k]) {               if (!p)                 p = cnt[k];               else if (p != cnt[k])                 ok = false;             }           }           cnt[j]++;           if (ok) ans = i;         }       }     }     cout << ans;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int tc = 1, ddd = 0;     while (tc--) {       solve();     }   }   