#include using namespace std; string str, rstr; int main() { int n; cin >> n >> str; rstr = str; reverse(rstr.begin(), rstr.end()); long long hash = 0, rhash = 0, cur = 1; int len = 0; for(int i = 0; i < n; i++){ // normalno, od zadaj hash = hash + (str[n - 1 - i] - 'a' + 1) * cur; cur *= 37; // reverse, od spredaj rhash = rhash * 37 + (rstr[i] - 'a' + 1); if(rhash == hash){ len = i + 1; } } printf("%d\n", n - len); return 0; }