n=int(input()) s=list(input()) a=0 for c in range(1,n+1): for i in range(n+1-c): t=s[i:i+c] if list(reversed(t))==t: a+=1 print(a)