from itertools import combinations n=int(input()) s=list(input()) idx=[i for i in range(n)] idx=list(combinations(idx,5)) ans=0 for ord in idx: word=[] for i in ord: word.append(s[i]) if word[0]==word[2] and word[1]!=word[3] and word[3]!=word[4] and word[1]!=word[4] and len(set(word))==4 and word[0]!=word[1] and word[0]!=word[3] and word[0]!=word[4]: ans+=1 print(ans)