#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


vector<int> manacher(string s){
  int n=s.size();
  vector<int> v(n);
  for(int i=0,j=0;i<n;){
    while(i-j>=0&&i+j<n&&s[i-j]==s[i+j]) j++;
    v[i]=j;
    int k=1;
    while(i-k>=0&&i+k<n&&k+v[i-k]<j) v[i+k]=v[i-k],k++;
    i+=k;j-=k;
  }
  return v;
}


template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}

//INSERT ABOVE HERE
signed main(){
  int n;
  cin>>n;
  string t;
  cin>>t;
  auto ms=manacher(t);

  for(int l=2;l<=n;l++){
    int flg=1;
    for(int i=l-1;i<n;i+=l-1)
      flg&=ms[i]==min(i+1,n-i);
    if(flg) drop(l);
  }

  assert(0);
  return 0;
}

