#include<bits/stdc++.h> using namespace std; string s,a="",b=""; int n,ans; int main(){ cin>>n>>s; for(int i=n-1;i>=0;i--){ a+=s[i]; b=s[i]+b; if(a==b)ans=i; } cout<<ans; return 0; }
1≤N≤4×1051\le N\le4\times 10^51≤N≤4×105