n=int(eval(input()))

s=eval(input())

ans=0

for i in range(1000):

    if i<10:

        ss="00"+str(i)

    elif i<100:

        ss="0"+str(i)

    else:

        ss=str(i)

    k=0

    for j in range(n):

        if s[j]==ss[k]:

            k+=1

        if k==3:

            break

    if k==3:

        ans+=1

print(ans)

n=int(eval(input()))

s=eval(input())

ans=0

from collections import Counter

c=Counter(s)

for i in range(1000):

    x=str(i)

    if len(x)==1:

        x="00"+x

    elif len(x)==2:

        x="0"+x

    k=0

    for j in range(n):

        if s[j]==x[k]:

            k+=1

        if k==3:

            ans+=1

            break

        

print(ans)

n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1000):
    if i < 10:
        ss = "00" + str(i)
    elif i < 100:
        ss = "0" + str(i)
    else:
        ss = str(i)
    k = 0
    for j in range(n):
        if s[j] == ss[k]:
            k += 1
        if k == 3:
            break
    if k == 3:
        ans += 1
print(ans)

n = int(eval(input()))
s = eval(input())
ans = 0
from collections import Counter

c = Counter(s)
for i in range(1000):
    x = str(i)
    if len(x) == 1:
        x = "00" + x
    elif len(x) == 2:
        x = "0" + x
    k = 0
    for j in range(n):
        if s[j] == x[k]:
            k += 1
        if k == 3:
            ans += 1
            break
print(ans)

+from collections import Counter + +c = Counter(s) -    if i < 10: -        ss = "00" + str(i) -    elif i < 100: -        ss = "0" + str(i) -    else: -        ss = str(i) +    x = str(i) +    if len(x) == 1: +        x = "00" + x +    elif len(x) == 2: +        x = "0" + x -        if s[j] == ss[k]: +        if s[j] == x[k]: +            ans += 1 -    if k == 3: -        ans += 1