func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long INF = 1e18 + 5;   const int mod = 1e9 + 7;   const int N = 3 * 1e5 + 5;   int n, c[N], maxOf[N];   int main() {     ios_base::sync_with_stdio(false);     cin >> n;     for (int i = 0; i < n; i++) {       cin >> c[i];       maxOf[c[i]] = i;     }     int last = c[n - 1];     int bb = -1;     for (int i = n - 1; i >= 0; i--) {       if (c[i] != last) {         bb = i;         break;       }     }     assert(bb != -1);     int ans = 0;     for (int i = 0; i < n; i++) {       if (c[i] != last) {         ans = max(ans, n - 1 - i);       } else {         ans = max(ans, bb - i);       }     }     cout << ans << endl;     return 0;   }   