n=int(eval(input()))

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

count=0

for p in range(10):

    for q in range(10):

        for r in range(10):

            if p in s[:n-2]:

                inp=s.index(p)

                if q in s[inp+1:n-1]:

                    inq=s[inp+1:n-1].index(q)+inp+1

                    if r in s[inq+1:]:

                        count+=1

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

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

count=0

for p in range(10):

        if p in s[:n-2]:

            inp=s.index(p)

            for q in range(10):

                if q in s[inp+1:n-1]:

                    inq=s[inp+1:n-1].index(q)+inp+1

                    for r in range(10):

                        if r in s[inq+1:]:

                            count+=1

print(count)
n = int(eval(input()))
s = [int(c) for c in eval(input())]
count = 0
for p in range(10):
    for q in range(10):
        for r in range(10):
            if p in s[: n - 2]:
                inp = s.index(p)
                if q in s[inp + 1 : n - 1]:
                    inq = s[inp + 1 : n - 1].index(q) + inp + 1
                    if r in s[inq + 1 :]:
                        count += 1
print(count)

n = int(eval(input()))
s = [int(c) for c in eval(input())]
count = 0
for p in range(10):
    if p in s[: n - 2]:
        inp = s.index(p)
        for q in range(10):
            if q in s[inp + 1 : n - 1]:
                inq = s[inp + 1 : n - 1].index(q) + inp + 1
                for r in range(10):
                    if r in s[inq + 1 :]:
                        count += 1
print(count)

-    for q in range(10): -        for r in range(10): -            if p in s[: n - 2]: -                inp = s.index(p) -                if q in s[inp + 1 : n - 1]: -                    inq = s[inp + 1 : n - 1].index(q) + inp + 1 +    if p in s[: n - 2]: +        inp = s.index(p) +        for q in range(10): +            if q in s[inp + 1 : n - 1]: +                inq = s[inp + 1 : n - 1].index(q) + inp + 1 +                for r in range(10):