n = int(eval(input()))

s = eval(input())



ans = 0

for i in range(1000):

  pin = '{:03d}'.format(i)

  p1 = s.find(pin[0])

  if p1>=0:    

    p2 = s[p1+1:].find(pin[1])     

    if p2>=0:

      p3 = s[p1+p2+2:].find(pin[2])      

      if p3>=0:

        ans+=1        

    

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

s = eval(input())



ans = 0

for i in range(1000):

  pin = '{:03d}'.format(i)

  p1 = s.find(pin[0])

  if p1>=0:    

    p2 = s.find(pin[1],p1+1)     

    if p2>=0:

      p3 = s.find(pin[2],p2+1)      

      if p3>=0:

        ans+=1        

    

print(ans)
n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1000):
    pin = "{:03d}".format(i)
    p1 = s.find(pin[0])
    if p1 >= 0:
        p2 = s[p1 + 1 :].find(pin[1])
        if p2 >= 0:
            p3 = s[p1 + p2 + 2 :].find(pin[2])
            if p3 >= 0:
                ans += 1
print(ans)

n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1000):
    pin = "{:03d}".format(i)
    p1 = s.find(pin[0])
    if p1 >= 0:
        p2 = s.find(pin[1], p1 + 1)
        if p2 >= 0:
            p3 = s.find(pin[2], p2 + 1)
            if p3 >= 0:
                ans += 1
print(ans)

-        p2 = s[p1 + 1 :].find(pin[1]) +        p2 = s.find(pin[1], p1 + 1) -            p3 = s[p1 + p2 + 2 :].find(pin[2]) +            p3 = s.find(pin[2], p2 + 1)