E: Round-trip String

story

This is the world where all human beings have become competition programmers. In this world, there are many customs that you cannot think of in the present age. One of them is the custom of sending a character string when expressing gratitude to parents, especially mothers. There are regional differences in what kind of character string is suitable for sending, but in the northern land of Hokkaido, the simplest possible character string is suitable as a gift. Also, the sending mother needs to answer to the child how beautiful the sent string is in return.

Now you are being consulted by the mother of one child. The mother got a nice string from her child, but she can't really measure how great it is. According to the custom of Hokkaido, the character string T to be sent to the mother is made by reciprocating a certain character string S. At this time, if S is the shortest possible string, it is a better string T. The mother rewards her child for her hard work, so she wants to find the shortest string that can make a T, but that's difficult. I want you to make full use of your programming ability to solve your mother's worries.

problem

From a string S of length 2 or more, generate a string T of length N according to the following rules. Here, let K be the string length of S, and T [i] represents the i-th character of the string T. Here, the first character of T is the 0th character.

T [i] = S [K -1 --| (i $ \ bmod $ (2K -2)) --K + 1 |]

Given only T, there can be multiple strings that produce T. Output the smallest string length K_ {min} among those strings.

Input format


N
T


Constraint

* 2 \ leq N = | T | \ leq 1,000,000
* String consists of lowercase letters only



Output format

Output the length K_ {min} of the shortest string S that produces T.

Input example 1


6
tabata


Output example 1


3

There are three possible possibilities: `tabata`,` tabat`, and `tab`, but the answer is 3 because` tab` is the shortest.

Input example 2


Four
hcpc


Output example 2


3

Input example 3


60
aaaaaabbbbbbbbbbbaaaaaaaaaaabbbbbbbbbbbaaaaaaaaaaabbbbbbbbbb


Output example 3


12





Example

Input

6
tabata


Output

3
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef pair<int,int>P;
typedef pair<P,int>P2;
#define fi first
#define se second
 
typedef unsigned long long ull;
 
 
struct RollingHash{
  typedef unsigned long long ull;
  string S;
  ull B;
  int len;
  vector<ull> hash,p;
  RollingHash(){}
  RollingHash(string S_,ull B_=1000000009LL):
    S(S_),B(B_),len(S.length()),hash(len+1),p(len+1){
    hash[0]=0;p[0]=1;
    for(int i=0;i<len;i++){
      hash[i+1]=hash[i]*B+S[i];
      p[i+1]=p[i]*B;
    }
  }
  //S[l,r)
  ull find(int l,int r){
    return hash[r]-hash[l]*p[r-l];
  }
};
 
signed main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  string t=s;
 
   set<char>st;
  r(i,n){
    st.insert(s[i]);
  }
 
  reverse(t.begin(),t.end());
 
  if(st.size()==1){
    cout<<2<<endl;
    return 0;
  }
 
  RollingHash S(s);
  RollingHash T(t);
 
  for(int i=2;i<=n;i++){
 
    int idx=0 , F=0 ;
    ull A=S.find(0,i);
 
    for(int j=0;;j++){
 
      if(j%2==0){
 
        if(idx+i>n){//cout<<j<<endl;
          int x=n-idx;
          ull has=S.find(0,x);
 
          if(S.find(idx,n)!=has){
            F++;
            break;
          }
        }
 
        else{
        if(S.find(idx,idx+i) != A){
          F++;
          break;
        }}
      }
 
      else{
 
        if(n-idx-i<0){
 
          ull has=S.find(i-(n-idx),i);
 
          //cout<<i-n-idx<<' '<<i<<endl;
 
          if(T.find(0,n-idx)!=has){
            F++;
            break;
          }
        }
 
        else{
        if(T.find(n-idx-i,n-idx) != A){
          //cout<<n-idx-i<<' '<<n-idx<<endl;
          F++;
          break;
        }}
      }
 
      idx+=i-1;
 
      //cout<<idx<<endl;
 
      if(idx>n)break;
    }
 
    //cout<<idx<<' '<<i<<endl;
    if(!F){
 
      cout<<i<<endl;
      return 0;
 
    }
  }
 
}
