Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 13:15:15 2020

@author: liang
"""

"""
1.全探索 i,j,kを固定してそれぞれの番号を調べる => O(N^3)
2.全探索3桁の暗証番号000~999が文字列Sにあるか調べる =>O(N)
"""
"""
解1.コード　=> TLE
#使用済みリストを用意することで枝刈り
N = int(input())
S = list(map(int,input().split()))
num_used = [list() for i in range(10)]
numbers = list()
for i in range(N):
    for j in range(i+1, N):
        if S[j] in num_used[S[i]]:
            continue
        else:
            num_used[S[i]].append(S[j])
            for k in range(j+1,N):
                number = str(S[i]) + str(S[j]) + str(S[k])
                if number not in numbers:
                    numbers.append(number)
print(len(numbers))
"""
#解2コード => O(N)
N = int(input())
S = input()
ans = 0
for i in range(1000):
    a = i//100
    b = i%100//10 ###400//10 = 40
    c = i%10
    num = str(a) + str(b) + str(c) 
    flag = 0
    for j in range(N) :
        if S[j] == num[flag]:
            flag += 1
        if flag == 3:
            ans += 1
            break
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 13:15:15 2020

@author: liang
"""

"""
1.全探索 i,j,kを固定してそれぞれの番号を調べる => O(N^3)
2.全探索3桁の暗証番号000~999が文字列Sにあるか調べる =>O(N)
"""
"""
解1.コード　=> TLE
#使用済みリストを用意することで枝刈り
N = int(input())
S = list(map(int,input().split()))
num_used = [list() for i in range(10)]
numbers = list()
for i in range(N):
    for j in range(i+1, N):
        if S[j] in num_used[S[i]]:
            continue
        else:
            num_used[S[i]].append(S[j])
            for k in range(j+1,N):
                number = str(S[i]) + str(S[j]) + str(S[k])
                if number not in numbers:
                    numbers.append(number)
print(len(numbers))
"""
#解2コード => O(N)
N = int(input())
S = input()
ans = 0
for i in range(1000):
#0で埋めるプログラム
#    a = i//100
#    b = i%100//10 ###400//10 = 40
#    c = i%10
#    num = str(a) + str(b) + str(c) 
    t = str(i).zfill(3) #0で埋めるメソッド
#フラグを立てて探す => O(N)    
#    flag = 0
#    for j in range(N) :
#        if S[j] == t[flag]:
#            flag += 1
#        if flag == 3:
#            ans += 1
    a = S.find(t[0])
    b = S.find(t[1],a+1)
    c = S.find(t[2],b+1)
    if a != -1 and b != -1 and c != -1:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 13:15:15 2020

@author: liang
"""

"""
1.全探索 i,j,kを固定してそれぞれの番号を調べる => O(N^3)
2.全探索3桁の暗証番号000~999が文字列Sにあるか調べる =>O(N)
"""
"""
解1.コード　=> TLE
#使用済みリストを用意することで枝刈り
N = int(input())
S = list(map(int,input().split()))
num_used = [list() for i in range(10)]
numbers = list()
for i in range(N):
    for j in range(i+1, N):
        if S[j] in num_used[S[i]]:
            continue
        else:
            num_used[S[i]].append(S[j])
            for k in range(j+1,N):
                number = str(S[i]) + str(S[j]) + str(S[k])
                if number not in numbers:
                    numbers.append(number)
print(len(numbers))
"""
#解2コード => O(N)
N = int(input())
S = input()
ans = 0
for i in range(1000):
    a = i//100
    b = i%100//10 ###400//10 = 40
    c = i%10
    num = str(a) + str(b) + str(c) 
    flag = 0
    for j in range(N) :
        if S[j] == num[flag]:
            flag += 1
        if flag == 3:
            ans += 1
            break
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 13:15:15 2020

@author: liang
"""

"""
1.全探索 i,j,kを固定してそれぞれの番号を調べる => O(N^3)
2.全探索3桁の暗証番号000~999が文字列Sにあるか調べる =>O(N)
"""
"""
解1.コード　=> TLE
#使用済みリストを用意することで枝刈り
N = int(input())
S = list(map(int,input().split()))
num_used = [list() for i in range(10)]
numbers = list()
for i in range(N):
    for j in range(i+1, N):
        if S[j] in num_used[S[i]]:
            continue
        else:
            num_used[S[i]].append(S[j])
            for k in range(j+1,N):
                number = str(S[i]) + str(S[j]) + str(S[k])
                if number not in numbers:
                    numbers.append(number)
print(len(numbers))
"""
#解2コード => O(N)
N = int(input())
S = input()
ans = 0
for i in range(1000):
#0で埋めるプログラム
#    a = i//100
#    b = i%100//10 ###400//10 = 40
#    c = i%10
#    num = str(a) + str(b) + str(c) 
    t = str(i).zfill(3) #0で埋めるメソッド
#フラグを立てて探す => O(N)    
#    flag = 0
#    for j in range(N) :
#        if S[j] == t[flag]:
#            flag += 1
#        if flag == 3:
#            ans += 1
    a = S.find(t[0])
    b = S.find(t[1],a+1)
    c = S.find(t[2],b+1)
    if a != -1 and b != -1 and c != -1:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 13:15:15 2020

@author: liang
"""

N = int(input())
S = input()
numbers = list()
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1,N):
            number = str(S[i]) + str(S[j]) + str(S[k])
            if number not in numbers:
                numbers.append(number)
print(len(numbers))

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 13:15:15 2020

@author: liang
"""

"""
1.全探索 i,j,kを固定してそれぞれの番号を調べる => O(N^3)
2.全探索3桁の暗証番号000~999が文字列Sにあるか調べる =>O(N)
"""
"""
解1.コード　=> TLE
#使用済みリストを用意することで枝刈り
N = int(input())
S = list(map(int,input().split()))
num_used = [list() for i in range(10)]
numbers = list()
for i in range(N):
    for j in range(i+1, N):
        if S[j] in num_used[S[i]]:
            continue
        else:
            num_used[S[i]].append(S[j])
            for k in range(j+1,N):
                number = str(S[i]) + str(S[j]) + str(S[k])
                if number not in numbers:
                    numbers.append(number)
print(len(numbers))
"""
#解2コード => O(N)
N = int(input())
S = input()
ans = 0
for i in range(1000):
#0で埋めるプログラム
#    a = i//100
#    b = i%100//10 ###400//10 = 40
#    c = i%10
#    num = str(a) + str(b) + str(c) 
    t = str(i).zfill(3) #0で埋めるメソッド
#フラグを立てて探す => O(N)    
#    flag = 0
#    for j in range(N) :
#        if S[j] == t[flag]:
#            flag += 1
#        if flag == 3:
#            ans += 1
    a = S.find(t[0])
    b = S.find(t[1],a+1)
    c = S.find(t[2],b+1)
    if a != -1 and b != -1 and c != -1:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 13:15:15 2020

@author: liang
"""

N = int(input())
S = input()
numbers = list()
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1,N):
            number = str(S[i]) + str(S[j]) + str(S[k])
            if number not in numbers:
                numbers.append(number)
print(len(numbers))

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 13:15:15 2020

@author: liang
"""

"""
1.全探索 i,j,kを固定してそれぞれの番号を調べる => O(N^3)
2.全探索3桁の暗証番号000~999が文字列Sにあるか調べる =>O(N)
"""
"""
解1.コード　=> TLE
#使用済みリストを用意することで枝刈り
N = int(input())
S = list(map(int,input().split()))
num_used = [list() for i in range(10)]
numbers = list()
for i in range(N):
    for j in range(i+1, N):
        if S[j] in num_used[S[i]]:
            continue
        else:
            num_used[S[i]].append(S[j])
            for k in range(j+1,N):
                number = str(S[i]) + str(S[j]) + str(S[k])
                if number not in numbers:
                    numbers.append(number)
print(len(numbers))
"""
#解2コード => O(N)
N = int(input())
S = input()
ans = 0
for i in range(1000):
#0で埋めるプログラム
#    a = i//100
#    b = i%100//10 ###400//10 = 40
#    c = i%10
#    num = str(a) + str(b) + str(c) 
    t = str(i).zfill(3) #0で埋めるメソッド
#フラグを立てて探す => O(N)    
#    flag = 0
#    for j in range(N) :
#        if S[j] == t[flag]:
#            flag += 1
#        if flag == 3:
#            ans += 1
    a = S.find(t[0])
    b = S.find(t[1],a+1)
    c = S.find(t[2],b+1)
    if a != -1 and b != -1 and c != -1:
        ans += 1
print(ans)