N = int(input()) S = input() ans = 0 for l in range(N): for r in range(l,N): ans += S[l:r+1] == S[l:r+1][::-1] print(ans)