N=int(eval(input()))

S=eval(input())



ret=0



for i in range(1000):

    pin="{:0>3}".format(i)

    

    pos=0

    begin=0

    while pos<3:

        begin=S.find(pin[pos],begin)+1

        if begin==0:

            break



        pos+=1

    else:

        ret+=1



print(ret)

n=int(eval(input()))

s=eval(input())



ans=0

for i in range(1000):

    cs=str(i).zfill(3)

    p=0

    for c in cs:

        p=s.find(c,p)



        if p==-1:

            break

        p+=1



    else:

        ans+=1



print(ans)
N = int(eval(input()))
S = eval(input())
ret = 0
for i in range(1000):
    pin = "{:0>3}".format(i)
    pos = 0
    begin = 0
    while pos < 3:
        begin = S.find(pin[pos], begin) + 1
        if begin == 0:
            break
        pos += 1
    else:
        ret += 1
print(ret)

n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1000):
    cs = str(i).zfill(3)
    p = 0
    for c in cs:
        p = s.find(c, p)
        if p == -1:
            break
        p += 1
    else:
        ans += 1
print(ans)

-N = int(eval(input())) -S = eval(input()) -ret = 0 +n = int(eval(input())) +s = eval(input()) +ans = 0 -    pin = "{:0>3}".format(i) -    pos = 0 -    begin = 0 -    while pos < 3: -        begin = S.find(pin[pos], begin) + 1 -        if begin == 0: +    cs = str(i).zfill(3) +    p = 0 +    for c in cs: +        p = s.find(c, p) +        if p == -1: -        pos += 1 +        p += 1 -        ret += 1 -print(ret) +        ans += 1 +print(ans)