n=int(eval(input()))

s=eval(input())

ans=0

for i in range(1000):

  t_str=str(i)

  t_len=len(t_str)

  t_str=(3-t_len)*"0"+t_str

  cur_idx=0

  ok=0

  for j,ss in enumerate(s):

    if ss==t_str[cur_idx]:

      cur_idx+=1

      ok+=1

    if cur_idx==3:break

  if cur_idx==3:

    ans+=1

print(ans) 



n = int(eval(input()))

s = eval(input())

ans = 0

for i in range(1000):

    tmp = str(i).zfill(3)

    number = [tmp[0],tmp[1],tmp[2],"OK"]

    pos = 0

    for ss in s:

        if ss == number[pos] and pos < 3:

            pos += 1

    if number[pos] == "OK":

        ans += 1

print(ans)
n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1000):
    t_str = str(i)
    t_len = len(t_str)
    t_str = (3 - t_len) * "0" + t_str
    cur_idx = 0
    ok = 0
    for j, ss in enumerate(s):
        if ss == t_str[cur_idx]:
            cur_idx += 1
            ok += 1
        if cur_idx == 3:
            break
    if cur_idx == 3:
        ans += 1
print(ans)

n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1000):
    tmp = str(i).zfill(3)
    number = [tmp[0], tmp[1], tmp[2], "OK"]
    pos = 0
    for ss in s:
        if ss == number[pos] and pos < 3:
            pos += 1
    if number[pos] == "OK":
        ans += 1
print(ans)

-    t_str = str(i) -    t_len = len(t_str) -    t_str = (3 - t_len) * "0" + t_str -    cur_idx = 0 -    ok = 0 -    for j, ss in enumerate(s): -        if ss == t_str[cur_idx]: -            cur_idx += 1 -            ok += 1 -        if cur_idx == 3: -            break -    if cur_idx == 3: +    tmp = str(i).zfill(3) +    number = [tmp[0], tmp[1], tmp[2], "OK"] +    pos = 0 +    for ss in s: +        if ss == number[pos] and pos < 3: +            pos += 1 +    if number[pos] == "OK":