_,s=open(0);print(sum(t==t[::-1]for k in range(8**6)if(t:=s[k%512:k%513])))