#include <bits/stdc++.h>
using namespace std;

using ll = long long int;
using ull = unsigned long long int;

constexpr ll MODS[2] = {ll(1e9+7), ll(1e9+9)};

struct RollingHash{
    vector<vector<ll> > powb, rhash;
    void build(string &str, const ll base = ll(1e5+7)) {
        int N = str.size();
        int M = 2;
        powb.resize(M);
        rhash.resize(M);
        for(int k=0;k<M;k++){
            powb[k].resize(N+1);
            rhash[k].resize(N+1);
            powb[k][0] = 1;
            rhash[k][0] = 0;
            for (int i = 0; i < N; i++) {
                rhash[k][i+1] = (str[i] + rhash[k][i] * base) % MODS[k];
                powb[k][i+1] = powb[k][i] * base % MODS[k];
            }
        }
    }

    //[l,r)
    ll get_hash(int k, int l, int r) { return (rhash[k][r] - rhash[k][l]*powb[k][r-l]%MODS[k]+MODS[k])%MODS[k]; }
    
    bool match(int l1, int r1, int l2, int r2){
        bool res = true;
        for(int k=0; k<2; k++){
            res &= get_hash(k, l1, r1) == get_hash(k, l2, r2);
        }
        return res;
    }
};

int main(){
    int n;
    string t;
    cin >> n >> t;

    t.insert(t.end(),t.rbegin(),t.rend());
    RollingHash h;
    h.build(t);

    for(int k=2;k<=n;k++){
        int len=k, idx=k;
        while(idx < n){
            int r = min(idx-1+len,n), l = idx-(r-idx+1);
            if(h.match(l, r, n*2-r, n*2-l)){
                idx = r;
                len = len*2-1;
            }else{
                break;
            }
        }
        if(idx==n){
            cout << k << endl;
            break;
        }
    }
    return 0;
}
