Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(input())

delKeta = N-3
ans = []
for V3 in range(10):
    for i in range(N-2):
        if(V3==int(S[i])):
            p1=i
            for V2 in range(10):
                for j in range(p1+1,N-1):
                    if(V2==int(S[j])):
                        p2=j
                        for V1 in range(10):
                            for k in range(p2+1,N):
                                if(V1==int(S[k])):
                                    ans.append(S[k]+S[p2]+S[p1])
                                    break
                        break
            break
                



print(len(set(ans)))



Fixed submission:
N = int(input())
S = list(map(int,input()))
count = 0

for x100 in range(10):
    if x100 in S[:N-2]:
        ind_100 = S.index(x100)
        
        for x10 in range(10):
            if x10 in S[ind_100+1:N-1]:
                ind_10 = S[ind_100+1:N-1].index(x10) + ind_100 + 1
                
                for x1 in range(10):
                    if x1 in S[ind_10 + 1:]:
                        count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(input())
ans=[]
for v in range(1000):
    tmp = ''
    i = 0
    j = 0
    V=[v//100,(v%100)//10,v%10]
    while i < N:
        if(V[j] == int(S[i])):
            tmp+=S[i]
            j += 1
        if(j==3):
            ans.append(tmp)
            break
        i+=1

print(len(set(ans)))


Fixed submission:
N = int(input())
S = list(map(int,input()))
count = 0

for x100 in range(10):
    if x100 in S[:N-2]:
        ind_100 = S.index(x100)
        
        for x10 in range(10):
            if x10 in S[ind_100+1:N-1]:
                ind_10 = S[ind_100+1:N-1].index(x10) + ind_100 + 1
                
                for x1 in range(10):
                    if x1 in S[ind_10 + 1:]:
                        count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(input())

delKeta = N-3
Vall = []
ans=[]
for V3 in range(10):
    for V2 in range(10):
        for V1 in range(10):
            Vall.append([V1, V2, V3])

for V in Vall:
    tmp = ''
    i = 0
    j = 0
    while i < N:
        if(V[j] == int(S[i])):
            tmp+=S[i]
            j += 1
        if(j==3):
            ans.append(tmp)
            break
        i+=1

print(len(set(ans)))

Fixed submission:
N = int(input())
S = list(map(int,input()))
count = 0

for x100 in range(10):
    if x100 in S[:N-2]:
        ind_100 = S.index(x100)
        
        for x10 in range(10):
            if x10 in S[ind_100+1:N-1]:
                ind_10 = S[ind_100+1:N-1].index(x10) + ind_100 + 1
                
                for x1 in range(10):
                    if x1 in S[ind_10 + 1:]:
                        count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(input())

delKeta = N-3
Vall = []
ans=[]
for V3 in range(10):
    for V2 in range(10):
        for V1 in range(10):
            Vall.append([V1, V2, V3])

for V in Vall:
    tmp = ''
    i = 0
    j = 0
    while i < N:
        if(V[j] == int(S[i])):
            tmp+=S[i]
            j += 1
        if(j==3):
            break
        i+=1
    if(len(tmp) == 3):
        ans.append(tmp)

print(len(set(ans)))


Fixed submission:
N = int(input())
S = list(map(int,input()))
count = 0

for x100 in range(10):
    if x100 in S[:N-2]:
        ind_100 = S.index(x100)
        
        for x10 in range(10):
            if x10 in S[ind_100+1:N-1]:
                ind_10 = S[ind_100+1:N-1].index(x10) + ind_100 + 1
                
                for x1 in range(10):
                    if x1 in S[ind_10 + 1:]:
                        count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(input())
Vall = []
ans=[]

for V3 in range(10):
    for V2 in range(10):
        for V1 in range(10):
            Vall.append([V1, V2, V3])

for V in Vall:
    tmp = ''
    p = 0
    j = 0
    while j < 3:
        for i in range(p, N):
            if(V[j] == int(S[i])):
                p = 1+i
                tmp += S[i]
                j += 1
                break
        else:
            break
    if(len(tmp) == 3):
        ans.append(tmp)

print(len(set(ans)))

Fixed submission:
N = int(input())
S = list(map(int,input()))
count = 0

for x100 in range(10):
    if x100 in S[:N-2]:
        ind_100 = S.index(x100)
        
        for x10 in range(10):
            if x10 in S[ind_100+1:N-1]:
                ind_10 = S[ind_100+1:N-1].index(x10) + ind_100 + 1
                
                for x1 in range(10):
                    if x1 in S[ind_10 + 1:]:
                        count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(input())

delKeta = N-3
ans = []
for V3 in range(10):
    for i in range(N):
        if(V3==int(S[i])):
            p1=i
            for V2 in range(10):
                for j in range(p1+1,N):
                    if(V2==int(S[j])):
                        p2=j
                        for V1 in range(10):
                            for k in range(p2+1,N):
                                if(V1==int(S[k])):
                                    ans.append(S[k]+S[p2]+S[p1])
                                    break
                        break
            break
                



print(len(set(ans)))



Fixed submission:
N = int(input())
S = list(map(int,input()))
count = 0

for x100 in range(10):
    if x100 in S[:N-2]:
        ind_100 = S.index(x100)
        
        for x10 in range(10):
            if x10 in S[ind_100+1:N-1]:
                ind_10 = S[ind_100+1:N-1].index(x10) + ind_100 + 1
                
                for x1 in range(10):
                    if x1 in S[ind_10 + 1:]:
                        count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(input())

delKeta = N-3
ans = []
for V3 in range(10):
    for i in range(N):
        if(V3==int(S[i])):
            p1=i
            for V2 in range(10):
                for j in range(p1+1,N):
                    if(V2==int(S[j])):
                        p2=j
                
                        for V1 in range(10):
                            for k in range(p2+1,N):
                                if(V1==int(S[k])):
                                    ans.append(S[k]+S[p2]+S[p1])
                                    



print(len(set(ans)))



Fixed submission:
N = int(input())
S = list(map(int,input()))
count = 0

for x100 in range(10):
    if x100 in S[:N-2]:
        ind_100 = S.index(x100)
        
        for x10 in range(10):
            if x10 in S[ind_100+1:N-1]:
                ind_10 = S[ind_100+1:N-1].index(x10) + ind_100 + 1
                
                for x1 in range(10):
                    if x1 in S[ind_10 + 1:]:
                        count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=list(input())

delKeta=N-3
ans=[]


for i in range(N):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            ans.append(int(S[i]+S[j]+S[k]))
    #print(i+1,len(set(ans)))


s=set(ans)
print(len(s))




Fixed submission:
N = int(input())
S = list(map(int,input()))
count = 0

for x100 in range(10):
    if x100 in S[:N-2]:
        ind_100 = S.index(x100)
        
        for x10 in range(10):
            if x10 in S[ind_100+1:N-1]:
                ind_10 = S[ind_100+1:N-1].index(x10) + ind_100 + 1
                
                for x1 in range(10):
                    if x1 in S[ind_10 + 1:]:
                        count += 1
print(count)