N = int(input()) S = input() from collections import Counter ans = 0 C_S = Counter(S) for i in range(min(1000, int(S))): isOK = True tmp = Counter(S) for t in list(str(i).zfill(3)): if t in tmp: tmp[t] -= 1 else: isOK = False for v in tmp.values(): if v < 0: isOK = False if isOK: ans += 1 print(ans)