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