def I(): return int(eval(input()))

def S(): return eval(input())

N = I()

S = S()

s1,s2,s3 = set(),set(),set()

for x in S:

    for z in s2:

        s3.add(z+x)

    for y in s1:

        s2.add(y+x)

    s1.add(x)

print((len(s3)))

def I(): return int(eval(input()))

def S(): return eval(input())

N = I()

S = S()

ans = 0

for i in range(1000):

    z = str(i).zfill(3)

    if S.find(z[0])==-1:

        continue

    S1 = S[S.find(z[0])+1:]

    if S1.find(z[1])==-1:

        continue

    S2 = S1[S1.find(z[1])+1:]

    if S2.find(z[2])==-1:

        continue

    ans += 1

print(ans)
def I():
    return int(eval(input()))


def S():
    return eval(input())


N = I()
S = S()
s1, s2, s3 = set(), set(), set()
for x in S:
    for z in s2:
        s3.add(z + x)
    for y in s1:
        s2.add(y + x)
    s1.add(x)
print((len(s3)))

def I():
    return int(eval(input()))


def S():
    return eval(input())


N = I()
S = S()
ans = 0
for i in range(1000):
    z = str(i).zfill(3)
    if S.find(z[0]) == -1:
        continue
    S1 = S[S.find(z[0]) + 1 :]
    if S1.find(z[1]) == -1:
        continue
    S2 = S1[S1.find(z[1]) + 1 :]
    if S2.find(z[2]) == -1:
        continue
    ans += 1
print(ans)

-s1, s2, s3 = set(), set(), set() -for x in S: -    for z in s2: -        s3.add(z + x) -    for y in s1: -        s2.add(y + x) -    s1.add(x) -print((len(s3))) +ans = 0 +for i in range(1000): +    z = str(i).zfill(3) +    if S.find(z[0]) == -1: +        continue +    S1 = S[S.find(z[0]) + 1 :] +    if S1.find(z[1]) == -1: +        continue +    S2 = S1[S1.find(z[1]) + 1 :] +    if S2.find(z[2]) == -1: +        continue +    ans += 1 +print(ans)