N,S=open(0) R=range(len(S)) S=" "+S print(sum(S[i:j+1]==S[j:i-1:-1]>""for i in R for j in R))