n=int(input()) s=input() print(sum([s[j:i]==s[j:i][::-1]for i in range(1,n+1)for j in range(i)]))