N=int(input()) A=";"+input().strip()+"[" ANS=0 for i in range(1,N+1): for j in range(N): if A[i-j]==A[i+j]: ANS+=1 else: break for j in range(N): if A[i-j-1]==A[i+j]: ANS+=1 else: break print(ANS)