def resolve():

    N = int(input())

    S = input()



    ans = 0

    for i in range(1000):

        pw = str(i).zfill(3)

        pw_ind = 0

        for s in S:

            if s == pw[pw_ind]:

                pw_ind += 1

                if pw_ind == 3:

                    break

        if pw_ind == 3:

            ans += 1



    return print(ans)



if __name__ == "__main__":

    resolve()

def resolve():

    N = int(input())

    S = input()



    ans = set()

    for i in range(1000):

        str_i = str(i).zfill(3)

        idx1 = S.find(str_i[0], 0)

        idx2 = S.find(str_i[1], idx1 + 1)

        idx3 = S.find(str_i[2], idx2 + 1)

        if idx1 != -1 and idx2 != -1 and idx3 != -1:

            ans.add(str_i)





    return print(len(ans))



if __name__ == "__main__":

    resolve()

def resolve():
    N = int(input())
    S = input()
    ans = 0
    for i in range(1000):
        pw = str(i).zfill(3)
        pw_ind = 0
        for s in S:
            if s == pw[pw_ind]:
                pw_ind += 1
                if pw_ind == 3:
                    break
        if pw_ind == 3:
            ans += 1
    return print(ans)


if __name__ == "__main__":
    resolve()

def resolve():
    N = int(input())
    S = input()
    ans = set()
    for i in range(1000):
        str_i = str(i).zfill(3)
        idx1 = S.find(str_i[0], 0)
        idx2 = S.find(str_i[1], idx1 + 1)
        idx3 = S.find(str_i[2], idx2 + 1)
        if idx1 != -1 and idx2 != -1 and idx3 != -1:
            ans.add(str_i)
    return print(len(ans))


if __name__ == "__main__":
    resolve()

-    ans = 0 +    ans = set() -        pw = str(i).zfill(3) -        pw_ind = 0 -        for s in S: -            if s == pw[pw_ind]: -                pw_ind += 1 -                if pw_ind == 3: -                    break -        if pw_ind == 3: -            ans += 1 -    return print(ans) +        str_i = str(i).zfill(3) +        idx1 = S.find(str_i[0], 0) +        idx2 = S.find(str_i[1], idx1 + 1) +        idx3 = S.find(str_i[2], idx2 + 1) +        if idx1 != -1 and idx2 != -1 and idx3 != -1: +            ans.add(str_i) +    return print(len(ans))