#include using namespace std; #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() const int N = 1e6 + 7; int n, T[N]; string buf; char s[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> buf; string rbuf = buf; reverse(all(rbuf)); buf = rbuf + "#?" + buf; n = sz(buf); //cerr << buf << "\n"; for(int i = 0; i < n; i++) s[i + 1] = buf[i]; for(int i = 2; i <= n; i++) { int t = T[i - 1]; while(t > 0 && s[i] != s[t + 1]) { t = T[t]; } if(s[i] == s[t + 1]) t++; T[i] = t; //cerr << i << " " << T[i] << "\n"; } cout << (n - 2) / 2 - T[n] << "\n"; return 0; }