N=int(eval(input()))

S=eval(input())



answer=0

for i in range(1000):

  i0=i//100

  i1=(i//10)%10

  i2=i%10



  flag_num=0

  for s in S:

    if flag_num==0 and s==str(i0):

      flag_num+=1

    elif flag_num==1 and s==str(i1):

      flag_num+=1

    elif flag_num==2 and s==str(i2):

      answer+=1

      break

      

print(answer)
N=int(eval(input()))

S=list(map(int,list(eval(input()))))



answer=0

for i in range(1000):

  i0=i//100

  i1=(i//10)%10

  i2=i%10



  flag_num=0

  for s in S:

    if flag_num==0 and s==i0:

      flag_num+=1

    elif flag_num==1 and s==i1:

      flag_num+=1

    elif flag_num==2 and s==i2:

      answer+=1

      break

      

print(answer)
N = int(eval(input()))
S = eval(input())
answer = 0
for i in range(1000):
    i0 = i // 100
    i1 = (i // 10) % 10
    i2 = i % 10
    flag_num = 0
    for s in S:
        if flag_num == 0 and s == str(i0):
            flag_num += 1
        elif flag_num == 1 and s == str(i1):
            flag_num += 1
        elif flag_num == 2 and s == str(i2):
            answer += 1
            break
print(answer)

N = int(eval(input()))
S = list(map(int, list(eval(input()))))
answer = 0
for i in range(1000):
    i0 = i // 100
    i1 = (i // 10) % 10
    i2 = i % 10
    flag_num = 0
    for s in S:
        if flag_num == 0 and s == i0:
            flag_num += 1
        elif flag_num == 1 and s == i1:
            flag_num += 1
        elif flag_num == 2 and s == i2:
            answer += 1
            break
print(answer)

-S = eval(input()) +S = list(map(int, list(eval(input())))) -        if flag_num == 0 and s == str(i0): +        if flag_num == 0 and s == i0: -        elif flag_num == 1 and s == str(i1): +        elif flag_num == 1 and s == i1: -        elif flag_num == 2 and s == str(i2): +        elif flag_num == 2 and s == i2: