#三井住友2019 D 貪欲法

def main():

    import sys

    N = int(sys.stdin.readline())

    S = sys.stdin.readline().rstrip()

    ans = 0

    for i in range(1000):

        num = str(i).zfill(3)

        L = []

        k = 0

        for j in range(N):

            #print(num, S[j])

            if int(S[j])==int(num[k]):

                #print('Yes', num)

                L.append(S[j])

                k+=1

            if len(L)==3:

                #print(L)

                ans +=1

                break

                

    print(ans)

        

    

if __name__=='__main__':

    main()

#三井住友2019 D

def main():

    import sys

    N = int(sys.stdin.readline())

    S = sys.stdin.readline().rstrip()

    cnt = 0

    for i in range(0, 10):

        for j in range(0, 10):

            for k in range(0, 10):

                st1 = S.find(str(i))

                if st1 ==-1:

                    continue

                

                st2 = S[st1+1:].find(str(j))

                if st2 ==-1:

                    continue

              

                st3 = S[st1+st2+2:].find(str(k))

                if st3 ==-1:

                    continue

                #print(st1,st2,st3, i,j,k)

                cnt +=1

    print(cnt)





                    

    

   

    

if __name__=='__main__':

    main()
# 三井住友2019 D 貪欲法
def main():
    import sys

    N = int(sys.stdin.readline())
    S = sys.stdin.readline().rstrip()
    ans = 0
    for i in range(1000):
        num = str(i).zfill(3)
        L = []
        k = 0
        for j in range(N):
            # print(num, S[j])
            if int(S[j]) == int(num[k]):
                # print('Yes', num)
                L.append(S[j])
                k += 1
            if len(L) == 3:
                # print(L)
                ans += 1
                break
    print(ans)


if __name__ == "__main__":
    main()

# 三井住友2019 D
def main():
    import sys

    N = int(sys.stdin.readline())
    S = sys.stdin.readline().rstrip()
    cnt = 0
    for i in range(0, 10):
        for j in range(0, 10):
            for k in range(0, 10):
                st1 = S.find(str(i))
                if st1 == -1:
                    continue
                st2 = S[st1 + 1 :].find(str(j))
                if st2 == -1:
                    continue
                st3 = S[st1 + st2 + 2 :].find(str(k))
                if st3 == -1:
                    continue
                # print(st1,st2,st3, i,j,k)
                cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()

-# 三井住友2019 D 貪欲法 +# 三井住友2019 D -    ans = 0 -    for i in range(1000): -        num = str(i).zfill(3) -        L = [] -        k = 0 -        for j in range(N): -            # print(num, S[j]) -            if int(S[j]) == int(num[k]): -                # print('Yes', num) -                L.append(S[j]) -                k += 1 -            if len(L) == 3: -                # print(L) -                ans += 1 -                break -    print(ans) +    cnt = 0 +    for i in range(0, 10): +        for j in range(0, 10): +            for k in range(0, 10): +                st1 = S.find(str(i)) +                if st1 == -1: +                    continue +                st2 = S[st1 + 1 :].find(str(j)) +                if st2 == -1: +                    continue +                st3 = S[st1 + st2 + 2 :].find(str(k)) +                if st3 == -1: +                    continue +                # print(st1,st2,st3, i,j,k) +                cnt += 1 +    print(cnt)