n=int(eval(input()))

s=eval(input())

ans,a=0,[]

for i in range(n):

    if s[i] not in a:

        a+=[s[i]]

        b=[]

        for j in range(i+1,n):

            if s[j] not in b:

                b+=[s[j]]

                c=[]

                for k in range(j+1,n):

                    if s[k] not in c:

                        c+=[s[k]]

                        ans+=1

print(ans)
n=eval(input())

s=eval(input())

ans=0

for i in range(1000):

 i=str(i).zfill(3)

 a=s.find(i[0])

 if a!=-1:

  b=s.find(i[1],a+1)

  if b!=-1:

   if s.find(i[2],b+1)!=-1:ans+=1

print(ans)
n = int(eval(input()))
s = eval(input())
ans, a = 0, []
for i in range(n):
    if s[i] not in a:
        a += [s[i]]
        b = []
        for j in range(i + 1, n):
            if s[j] not in b:
                b += [s[j]]
                c = []
                for k in range(j + 1, n):
                    if s[k] not in c:
                        c += [s[k]]
                        ans += 1
print(ans)

n = eval(input())
s = eval(input())
ans = 0
for i in range(1000):
    i = str(i).zfill(3)
    a = s.find(i[0])
    if a != -1:
        b = s.find(i[1], a + 1)
        if b != -1:
            if s.find(i[2], b + 1) != -1:
                ans += 1
print(ans)

-n = int(eval(input())) +n = eval(input()) -ans, a = 0, [] -for i in range(n): -    if s[i] not in a: -        a += [s[i]] -        b = [] -        for j in range(i + 1, n): -            if s[j] not in b: -                b += [s[j]] -                c = [] -                for k in range(j + 1, n): -                    if s[k] not in c: -                        c += [s[k]] -                        ans += 1 +ans = 0 +for i in range(1000): +    i = str(i).zfill(3) +    a = s.find(i[0]) +    if a != -1: +        b = s.find(i[1], a + 1) +        if b != -1: +            if s.find(i[2], b + 1) != -1: +                ans += 1