#!/usr/bin/env python3

#三井住友信託銀行プログラミングコンテスト2019 D



import sys

import math

from bisect import bisect_right as br

from bisect import bisect_left as bl

sys.setrecursionlimit(1000000)

from heapq import heappush, heappop,heappushpop

from collections import defaultdict

from itertools import accumulate

from collections import Counter

from collections import deque

from operator import itemgetter

from itertools import permutations

mod = 10**9 + 7

inf = float('inf')

def I(): return int(sys.stdin.readline())

def LI(): return list(map(int,sys.stdin.readline().split()))



def C(n,r):

    return math.factorial(n)//math.factorial(n-r)//math.factorial(r)



n = I()

s = eval(input())

t = list(map(int,list(s)))

ans = 0

for i in range(10):

    for j in range(n):

        if i == t[j]:

            tmp = j

            break

    else:

        continue

    for j in range(100):

        if len(str(j)) == 2:

            x,y = list(str(j))

        else:

            x,y = '0',str(j)

        flg = False

        for k in range(tmp+1,n):

            if flg and y == str(t[k]):

                ans += 1

                break

            if x == str(t[k]):

                flg = True

print(ans)
#!/usr/bin/env python3



import sys

import math

from bisect import bisect_right as br

from bisect import bisect_left as bl

sys.setrecursionlimit(2147483647)

from heapq import heappush, heappop,heappushpop

from collections import defaultdict

from itertools import accumulate

from collections import Counter

from collections import deque

from operator import itemgetter

from itertools import permutations

mod = 10**9 + 7

inf = float('inf')

def I(): return int(sys.stdin.readline())

def LI(): return list(map(int,sys.stdin.readline().split()))



n = I()

s = eval(input())

ans = 0

for l in range(10):

    for i in range(n):

        if int(s[i]) == l:

            break

    else:

        continue

    for r in range(10):

        for j in range(i+1,n):

            if int(s[j]) == r:

                break

        else:

            continue

        num = [True]*10

        for k in range(j+1,n):

            if num[int(s[k])]:

                ans += 1

                num[int(s[k])] = False

print(ans)
#!/usr/bin/env python3
# 三井住友信託銀行プログラミングコンテスト2019 D
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl

sys.setrecursionlimit(1000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations

mod = 10**9 + 7
inf = float("inf")


def I():
    return int(sys.stdin.readline())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def C(n, r):
    return math.factorial(n) // math.factorial(n - r) // math.factorial(r)


n = I()
s = eval(input())
t = list(map(int, list(s)))
ans = 0
for i in range(10):
    for j in range(n):
        if i == t[j]:
            tmp = j
            break
    else:
        continue
    for j in range(100):
        if len(str(j)) == 2:
            x, y = list(str(j))
        else:
            x, y = "0", str(j)
        flg = False
        for k in range(tmp + 1, n):
            if flg and y == str(t[k]):
                ans += 1
                break
            if x == str(t[k]):
                flg = True
print(ans)

#!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl

sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations

mod = 10**9 + 7
inf = float("inf")


def I():
    return int(sys.stdin.readline())


def LI():
    return list(map(int, sys.stdin.readline().split()))


n = I()
s = eval(input())
ans = 0
for l in range(10):
    for i in range(n):
        if int(s[i]) == l:
            break
    else:
        continue
    for r in range(10):
        for j in range(i + 1, n):
            if int(s[j]) == r:
                break
        else:
            continue
        num = [True] * 10
        for k in range(j + 1, n):
            if num[int(s[k])]:
                ans += 1
                num[int(s[k])] = False
print(ans)

-# 三井住友信託銀行プログラミングコンテスト2019 D -sys.setrecursionlimit(1000000) +sys.setrecursionlimit(2147483647) -def C(n, r): -    return math.factorial(n) // math.factorial(n - r) // math.factorial(r) - - -t = list(map(int, list(s))) -for i in range(10): -    for j in range(n): -        if i == t[j]: -            tmp = j +for l in range(10): +    for i in range(n): +        if int(s[i]) == l: -    for j in range(100): -        if len(str(j)) == 2: -            x, y = list(str(j)) +    for r in range(10): +        for j in range(i + 1, n): +            if int(s[j]) == r: +                break -            x, y = "0", str(j) -        flg = False -        for k in range(tmp + 1, n): -            if flg and y == str(t[k]): +            continue +        num = [True] * 10 +        for k in range(j + 1, n): +            if num[int(s[k])]: -                break -            if x == str(t[k]): -                flg = True +                num[int(s[k])] = False