N = int(eval(input()))

S = eval(input())

count = 0



for i in range(0, 10):

    if str(i) in S:

        idx = S.index(str(i))

        for j in range(0, 10):

            if str(j) in S[idx+1:]:

                idx2 = S[idx+1:].index(str(j)) + idx + 1

                for k in range(0, 10):

                    if str(k) in S[idx2+1:]:

                        count += 1



print(count)

N = int(eval(input()))

S = eval(input())

count = 0

D = 3





def find_number(digits, series):

    global count

    if digits > 1:

        for i in range(0, 10):

            if str(i) in series:

                idx = series.index(str(i))

                find_number(digits - 1, series[idx+1:])

    elif digits == 1:

        for j in range(0, 10):

            if str(j) in series:

                count += 1

    return count





print((find_number(D, S)))

N = int(eval(input()))
S = eval(input())
count = 0
for i in range(0, 10):
    if str(i) in S:
        idx = S.index(str(i))
        for j in range(0, 10):
            if str(j) in S[idx + 1 :]:
                idx2 = S[idx + 1 :].index(str(j)) + idx + 1
                for k in range(0, 10):
                    if str(k) in S[idx2 + 1 :]:
                        count += 1
print(count)

N = int(eval(input()))
S = eval(input())
count = 0
D = 3


def find_number(digits, series):
    global count
    if digits > 1:
        for i in range(0, 10):
            if str(i) in series:
                idx = series.index(str(i))
                find_number(digits - 1, series[idx + 1 :])
    elif digits == 1:
        for j in range(0, 10):
            if str(j) in series:
                count += 1
    return count


print((find_number(D, S)))

-for i in range(0, 10): -    if str(i) in S: -        idx = S.index(str(i)) +D = 3 + + +def find_number(digits, series): +    global count +    if digits > 1: +        for i in range(0, 10): +            if str(i) in series: +                idx = series.index(str(i)) +                find_number(digits - 1, series[idx + 1 :]) +    elif digits == 1: -            if str(j) in S[idx + 1 :]: -                idx2 = S[idx + 1 :].index(str(j)) + idx + 1 -                for k in range(0, 10): -                    if str(k) in S[idx2 + 1 :]: -                        count += 1 -print(count) +            if str(j) in series: +                count += 1 +    return count + + +print((find_number(D, S)))