n=int(eval(input()))

S=eval(input())

ans=0

sublist=[]

for i in range(100):

    used=0

    j="0"*(2-len(str(i)))+str(i)

    flag1=False

    flag2=False

    for i in range(n):

        if not flag1 and S[i]==j[0]:

            flag1=True

            continue

        if flag1 and not flag2:

            if S[i]==j[1]:

                flag2=True

                used=i+1

    if flag2:

        sublist.append((j,used))

anslist=[]

for some in sublist:

    a1=some[0]

    index=some[1]

    lis=[0 for i in range(10)]

    for j in range(index,n):

        anslist.append(a1+S[j])

anslist=set(anslist)

print((len(anslist)))

n=int(eval(input()))

S=eval(input())



ans=0

for i in range(1000):

    j="0"*(3-len(str(i)))+str(i)

    flag1=False

    flag2=False

    flag3=False

    for i in range(n):

        if not flag1 and S[i]==j[0]:

            flag1=True

            continue

        if flag1 and not flag2:

            if S[i]==j[1]:

                flag2=True

                continue

        if flag2 and not flag3:

            if S[i]==j[2]:

                flag3=True

                break

    if flag3:

        ans+=1

print(ans)

n = int(eval(input()))
S = eval(input())
ans = 0
sublist = []
for i in range(100):
    used = 0
    j = "0" * (2 - len(str(i))) + str(i)
    flag1 = False
    flag2 = False
    for i in range(n):
        if not flag1 and S[i] == j[0]:
            flag1 = True
            continue
        if flag1 and not flag2:
            if S[i] == j[1]:
                flag2 = True
                used = i + 1
    if flag2:
        sublist.append((j, used))
anslist = []
for some in sublist:
    a1 = some[0]
    index = some[1]
    lis = [0 for i in range(10)]
    for j in range(index, n):
        anslist.append(a1 + S[j])
anslist = set(anslist)
print((len(anslist)))

n = int(eval(input()))
S = eval(input())
ans = 0
for i in range(1000):
    j = "0" * (3 - len(str(i))) + str(i)
    flag1 = False
    flag2 = False
    flag3 = False
    for i in range(n):
        if not flag1 and S[i] == j[0]:
            flag1 = True
            continue
        if flag1 and not flag2:
            if S[i] == j[1]:
                flag2 = True
                continue
        if flag2 and not flag3:
            if S[i] == j[2]:
                flag3 = True
                break
    if flag3:
        ans += 1
print(ans)

-sublist = [] -for i in range(100): -    used = 0 -    j = "0" * (2 - len(str(i))) + str(i) +for i in range(1000): +    j = "0" * (3 - len(str(i))) + str(i) +    flag3 = False -                used = i + 1 -    if flag2: -        sublist.append((j, used)) -anslist = [] -for some in sublist: -    a1 = some[0] -    index = some[1] -    lis = [0 for i in range(10)] -    for j in range(index, n): -        anslist.append(a1 + S[j]) -anslist = set(anslist) -print((len(anslist))) +                continue +        if flag2 and not flag3: +            if S[i] == j[2]: +                flag3 = True +                break +    if flag3: +        ans += 1 +print(ans)