n=int(eval(input()))

#s=[int(x) for x in input()]+[i for i in range(10)]*3

s=[int(x) for x in eval(input())]

cnt=0

for i in range(10):

 for j in range(10):

  for k in range(10):

   try:

    inx1=s.index(i)

   except:

    continue

   try:

    inx2=s[inx1+1:].index(j) + inx1 +1

   except:

    continue

   try:

    inx3=s[inx2+1:].index(k) + inx1 + inx2 +2

   except:

    continue

   cnt+=1

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

s=eval(input())



cnt=0

for i in range(1000):

  num=str(i).zfill(3)

  if num[0] in s:

    inx1=s.index(num[0])

    s2=s[inx1+1:]

    if num[1] in s2:

      inx2=s2.index(num[1])

      s3=s2[inx2+1:]

      if num[2] in s3:

        cnt+=1

print(cnt)
n = int(eval(input()))
# s=[int(x) for x in input()]+[i for i in range(10)]*3
s = [int(x) for x in eval(input())]
cnt = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            try:
                inx1 = s.index(i)
            except:
                continue
            try:
                inx2 = s[inx1 + 1 :].index(j) + inx1 + 1
            except:
                continue
            try:
                inx3 = s[inx2 + 1 :].index(k) + inx1 + inx2 + 2
            except:
                continue
            cnt += 1
print(cnt)

n = int(eval(input()))
s = eval(input())
cnt = 0
for i in range(1000):
    num = str(i).zfill(3)
    if num[0] in s:
        inx1 = s.index(num[0])
        s2 = s[inx1 + 1 :]
        if num[1] in s2:
            inx2 = s2.index(num[1])
            s3 = s2[inx2 + 1 :]
            if num[2] in s3:
                cnt += 1
print(cnt)

-# s=[int(x) for x in input()]+[i for i in range(10)]*3 -s = [int(x) for x in eval(input())] +s = eval(input()) -for i in range(10): -    for j in range(10): -        for k in range(10): -            try: -                inx1 = s.index(i) -            except: -                continue -            try: -                inx2 = s[inx1 + 1 :].index(j) + inx1 + 1 -            except: -                continue -            try: -                inx3 = s[inx2 + 1 :].index(k) + inx1 + inx2 + 2 -            except: -                continue -            cnt += 1 +for i in range(1000): +    num = str(i).zfill(3) +    if num[0] in s: +        inx1 = s.index(num[0]) +        s2 = s[inx1 + 1 :] +        if num[1] in s2: +            inx2 = s2.index(num[1]) +            s3 = s2[inx2 + 1 :] +            if num[2] in s3: +                cnt += 1