n=int(eval(input()))

s=list(eval(input()))

cnt=0

for i in range (10):

  i=str(i)

  for j in range (10):

    j=str(j)

    for k in range (10):

      k=str(k)

      if s.count(i)!=0:

        a=s.index(i)

        x=s[(a+1):]

        if x.count(j)!=0:

          b=x.index(j)

          y=x[(b+1):]

          if y.count(k)!=0:

            cnt+=1

 

print(cnt)     
n = int(eval(input()))

s = eval(input())

cnt = 0



for N in range(1000):

    tgt = str(N).zfill(3)

    if tgt[0] in s:

        i = s.index(tgt[0])

        if tgt[1] in s[i+1:]:

            j = s[i+1:].index(tgt[1]) + i

            if tgt[2] in s[j+2:]:

                cnt += 1

print(cnt)

n = int(eval(input()))
s = list(eval(input()))
cnt = 0
for i in range(10):
    i = str(i)
    for j in range(10):
        j = str(j)
        for k in range(10):
            k = str(k)
            if s.count(i) != 0:
                a = s.index(i)
                x = s[(a + 1) :]
                if x.count(j) != 0:
                    b = x.index(j)
                    y = x[(b + 1) :]
                    if y.count(k) != 0:
                        cnt += 1
print(cnt)

n = int(eval(input()))
s = eval(input())
cnt = 0
for N in range(1000):
    tgt = str(N).zfill(3)
    if tgt[0] in s:
        i = s.index(tgt[0])
        if tgt[1] in s[i + 1 :]:
            j = s[i + 1 :].index(tgt[1]) + i
            if tgt[2] in s[j + 2 :]:
                cnt += 1
print(cnt)

-s = list(eval(input())) +s = eval(input()) -for i in range(10): -    i = str(i) -    for j in range(10): -        j = str(j) -        for k in range(10): -            k = str(k) -            if s.count(i) != 0: -                a = s.index(i) -                x = s[(a + 1) :] -                if x.count(j) != 0: -                    b = x.index(j) -                    y = x[(b + 1) :] -                    if y.count(k) != 0: -                        cnt += 1 +for N in range(1000): +    tgt = str(N).zfill(3) +    if tgt[0] in s: +        i = s.index(tgt[0]) +        if tgt[1] in s[i + 1 :]: +            j = s[i + 1 :].index(tgt[1]) + i +            if tgt[2] in s[j + 2 :]: +                cnt += 1