n = int(eval(input()))

s = eval(input())

number = [n for n in range(10)]

ans = 0

for i in number:

    try:

        j = s.index(str(i))

        for k in number:

            try:

                l = s[j+1:].index(str(k))

                exist = [0]*10

                for m in s[l+j+2:]:

                    exist[int(m)] = 1

                #print(exist)

                ans += sum(exist)

            except:

                continue

    except:

        continue

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

s = eval(input())

number = [n for n in range(10)]

ans = 0

for i in number:

    try:

        j = s.index(str(i))

        for k in number:

            try:

                l = s[j+1:].index(str(k))

                ans += len(set(s[l+j+2:]))

            except:

                continue

    except:

        continue

print(ans)
n = int(eval(input()))
s = eval(input())
number = [n for n in range(10)]
ans = 0
for i in number:
    try:
        j = s.index(str(i))
        for k in number:
            try:
                l = s[j + 1 :].index(str(k))
                exist = [0] * 10
                for m in s[l + j + 2 :]:
                    exist[int(m)] = 1
                # print(exist)
                ans += sum(exist)
            except:
                continue
    except:
        continue
print(ans)

n = int(eval(input()))
s = eval(input())
number = [n for n in range(10)]
ans = 0
for i in number:
    try:
        j = s.index(str(i))
        for k in number:
            try:
                l = s[j + 1 :].index(str(k))
                ans += len(set(s[l + j + 2 :]))
            except:
                continue
    except:
        continue
print(ans)

-                exist = [0] * 10 -                for m in s[l + j + 2 :]: -                    exist[int(m)] = 1 -                # print(exist) -                ans += sum(exist) +                ans += len(set(s[l + j + 2 :]))