Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict

n = int(input())
s = input()
ans = 0
for i in range(1000):
    password = str(i).zfill(3)
    #print(password)
    for j in range(n):
        if s[j] == password[0]:
            for k in range(j + 1, n):
                if s[k] == password[1]:
                    for l in range(k + 1, n):
                        if s[l] == password[2]:
                            ans += 1
                            break
                    
                    break
            
            break
print(ans)

Fixed submission:
N = int(input())
S = input()

ans = 0
for i in range(1000):
    num = str(i).zfill(3)
    if S.find(num[0]) == -1:
        continue
    S1 = S[S.find(num[0]) + 1:]
    if S1.find(num[1]) == -1:
        continue
    S2 = S1[S1.find(num[1]) + 1:]
    if S2.find(num[2]) == -1:
        continue
    ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict

n = int(input())
s = input()
ans = 0
for i in range(1000):
    password = i
    #print(password)
    for j in range(n):
        if int(s[j]) == i // 100:
            for k in range(j + 1, n):
                if int(s[k]) == (i // 10) % 10:
                    for l in range(k + 1, n):
                        if int(s[l]) == i % 10:
                            ans += 1
                            break
                    
                    break
            
            break
print(ans)

Fixed submission:
N = int(input())
S = input()

ans = 0
for i in range(1000):
    num = str(i).zfill(3)
    if S.find(num[0]) == -1:
        continue
    S1 = S[S.find(num[0]) + 1:]
    if S1.find(num[1]) == -1:
        continue
    S2 = S1[S1.find(num[1]) + 1:]
    if S2.find(num[2]) == -1:
        continue
    ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict

n = int(input())
s = input()
passwords = defaultdict(int)
for i in range(1000):
    num = str(i)
    password = "0" * (3 - len(num)) + num
    #print(password)
    for j in range(n):
        if s[j] == password[0]:
            #print("OK1", password)
            for k in range(j + 1, n):
                if s[k] == password[1]:
                    #print("OK2")
                    for l in range(k + 1, n):
                        if s[l] == password[2]:
                            #print("OK3", password)
                            passwords["".join(password)] += 1
                            break
                
                    break
            break

print(len(passwords))

Fixed submission:
N = int(input())
S = input()

ans = 0
for i in range(1000):
    num = str(i).zfill(3)
    if S.find(num[0]) == -1:
        continue
    S1 = S[S.find(num[0]) + 1:]
    if S1.find(num[1]) == -1:
        continue
    S2 = S1[S1.find(num[1]) + 1:]
    if S2.find(num[2]) == -1:
        continue
    ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict

n = int(input())
s = input()
passwords = defaultdict(int)
for i in range(1000):
    password = [str(i // 100), str((i // 10) % 10), str(i % 10)]
    #print(password)
    for j in range(n):
        if s[j] == password[0]:
            #print("OK1", password)
            for k in range(j + 1, n):
                if s[k] == password[1]:
                    #print("OK2")
                    for l in range(k + 1, n):
                        if s[l] == password[2]:
                            #print("OK3", password)
                            passwords["".join(password)] += 1
                            break
                
                    break
            break

print(len(passwords))

Fixed submission:
N = int(input())
S = input()

ans = 0
for i in range(1000):
    num = str(i).zfill(3)
    if S.find(num[0]) == -1:
        continue
    S1 = S[S.find(num[0]) + 1:]
    if S1.find(num[1]) == -1:
        continue
    S2 = S1[S1.find(num[1]) + 1:]
    if S2.find(num[2]) == -1:
        continue
    ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict

n = int(input())
s = input()
passwords = defaultdict(int)
for i in range(1000):
    password = "0" * (3 - len(str(i))) + str(i)
    for j in range(n):
        if s[j] == password[0]:
            #print("OK1", password)
            for k in range(j + 1, n):
                if s[k] == password[1]:
                    #print("OK2")
                    for l in range(k + 1, n):
                        if s[l] == password[2]:
                            #print("OK3", password)
                            passwords[password] += 1
                            break
                
                    break
            break

print(len(passwords))

Fixed submission:
N = int(input())
S = input()

ans = 0
for i in range(1000):
    num = str(i).zfill(3)
    if S.find(num[0]) == -1:
        continue
    S1 = S[S.find(num[0]) + 1:]
    if S1.find(num[1]) == -1:
        continue
    S2 = S1[S1.find(num[1]) + 1:]
    if S2.find(num[2]) == -1:
        continue
    ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict

n = int(input())
s = input()
passwords = defaultdict(int)
for i in range(1000):
    password = "0" * (3 - len(str(i))) + str(i)
    for j in range(n):
        if s[j] == password[0]:
            #print("OK1", password)
            for k in range(j + 1, n):
                if s[k] == password[1]:
                    #print("OK2")
                    for l in range(k + 1, n):
                        if s[l] == password[2]:
                            #print("OK3", password)
                            passwords[password] += 1
                            break


print(len(passwords))

Fixed submission:
N = int(input())
S = input()

ans = 0
for i in range(1000):
    num = str(i).zfill(3)
    if S.find(num[0]) == -1:
        continue
    S1 = S[S.find(num[0]) + 1:]
    if S1.find(num[1]) == -1:
        continue
    S2 = S1[S1.find(num[1]) + 1:]
    if S2.find(num[2]) == -1:
        continue
    ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
n = int(input())
s = input()
passwords = defaultdict(int)
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            passwords[s[i] + s[j] + s[k]] += 1
        
print(len(passwords))

Fixed submission:
N = int(input())
S = input()

ans = 0
for i in range(1000):
    num = str(i).zfill(3)
    if S.find(num[0]) == -1:
        continue
    S1 = S[S.find(num[0]) + 1:]
    if S1.find(num[1]) == -1:
        continue
    S2 = S1[S1.find(num[1]) + 1:]
    if S2.find(num[2]) == -1:
        continue
    ans += 1

print(ans)