from itertools import combinations n = input() s = input() c = 0 for t in combinations(s, 5): ok = False if t[0] == t[2]: ok = True for i in range(5): for j in range(i + 1, 5): if not (i == 0 and j == 2): if t[i] == t[j]: ok = False c += int(ok) print(c)