N=int(eval(input()))

s=eval(input())

first=[-1 for i in range(10)]

last=[-1 for i in range(10)]

for i in range(len(s)):

    k=int(s[i])

    if first[k]==-1: first[k]=i

    last[k]=i



dic=set()

for i in range(10):

    for j in range(10):

        f=first[i]

        l=last[j]

        if f!=-1 and f+1<l:

            for k in range(f+1,l):

                dic.add(str(i)+s[k]+str(j))



print((len(dic)))
def main():

    N=int(eval(input()))

    s=eval(input())

    first=[-1 for i in range(10)]

    last=[-1 for i in range(10)]

    for i in range(len(s)):

        k=int(s[i])

        if first[k]==-1: first[k]=i

        last[k]=i



    ans=0

    for i in range(10):

        for j in range(10):

            f=first[i]

            l=last[j]

            if f!=-1 and f+1<l:

                for k in range(0,10):

                    if s.find(str(k),f+1,l)!=-1: ans+=1

                    



    print(ans)

     

if __name__ == '__main__':

    main()
N = int(eval(input()))
s = eval(input())
first = [-1 for i in range(10)]
last = [-1 for i in range(10)]
for i in range(len(s)):
    k = int(s[i])
    if first[k] == -1:
        first[k] = i
    last[k] = i
dic = set()
for i in range(10):
    for j in range(10):
        f = first[i]
        l = last[j]
        if f != -1 and f + 1 < l:
            for k in range(f + 1, l):
                dic.add(str(i) + s[k] + str(j))
print((len(dic)))

def main():
    N = int(eval(input()))
    s = eval(input())
    first = [-1 for i in range(10)]
    last = [-1 for i in range(10)]
    for i in range(len(s)):
        k = int(s[i])
        if first[k] == -1:
            first[k] = i
        last[k] = i
    ans = 0
    for i in range(10):
        for j in range(10):
            f = first[i]
            l = last[j]
            if f != -1 and f + 1 < l:
                for k in range(0, 10):
                    if s.find(str(k), f + 1, l) != -1:
                        ans += 1
    print(ans)


if __name__ == "__main__":
    main()

-N = int(eval(input())) -s = eval(input()) -first = [-1 for i in range(10)] -last = [-1 for i in range(10)] -for i in range(len(s)): -    k = int(s[i]) -    if first[k] == -1: -        first[k] = i -    last[k] = i -dic = set() -for i in range(10): -    for j in range(10): -        f = first[i] -        l = last[j] -        if f != -1 and f + 1 < l: -            for k in range(f + 1, l): -                dic.add(str(i) + s[k] + str(j)) -print((len(dic))) +def main(): +    N = int(eval(input())) +    s = eval(input()) +    first = [-1 for i in range(10)] +    last = [-1 for i in range(10)] +    for i in range(len(s)): +        k = int(s[i]) +        if first[k] == -1: +            first[k] = i +        last[k] = i +    ans = 0 +    for i in range(10): +        for j in range(10): +            f = first[i] +            l = last[j] +            if f != -1 and f + 1 < l: +                for k in range(0, 10): +                    if s.find(str(k), f + 1, l) != -1: +                        ans += 1 +    print(ans) + + +if __name__ == "__main__": +    main()