# ライブラリのインポート from itertools import combinations # 入力の受け取り n = int(input()) s = input() # 答えの数を計算 ans = 0 for p in combinations(range(n), 5): # 5文字の組み合わせを取得 a = s[p[0]] b = s[p[1]] c = s[p[2]] d = s[p[3]] e = s[p[4]] # 条件を満たすかチェック is_ok = True if a == b or a != c or a == d or a == e: is_ok = False if b == c or b == d or b == e: is_ok = False if c == d or c == e: is_ok = False if d == e: is_ok = False if is_ok: ans += 1 # 答えを出力 print(ans)