Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
cnt = 0
for i in range(1000):
    l = list()
    l.append(i // 100)
    l.append((i // 10) % 10)
    l.append(i % 10)
    f = 0
    for j in range(N):
        if int(S[j]) == l[f]:
            f += 1
        if f == 3:
            break
    if f == 3:
        cnt += 1
print(cnt)

Fixed submission:
N = int(input())
S = input()
cnt = 0
for i in range(1000):
    num = ''
    num += str(i // 100)
    num += str((i // 10) % 10)
    num += str(i % 10)
    j = 0
    for n in range(N):
        if S[n] == num[j]:
            j += 1
        if j == 3:
            break
    if j == 3:
        cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
cnt = 0
for i in range(1000):
    num = ''
    num += str(i // 100)
    num += str((i // 10) % 10)
    num += str(i % 10)
    j = 0
    for n in range(N):
        if S[n] == num[j]:
            j += 1
        if j == 3:
            break
    if j == 3:
        cnt += 1
print(cnt)

Fixed submission:
N = int(input())
S = input()
cnt = 0
for i in range(1000):
    num = ''
    num += str(i // 100)
    num += str((i // 10) % 10)
    num += str(i % 10)
    j = 0
    for n in range(N):
        if S[n] == num[j]:
            j += 1
        if j == 3:
            break
    if j == 3:
        cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
cnt = 0
for i in range(1000):
    num = ''
    num += str(i // 100)
    num += str((i // 10) % 10)
    num += str(i % 10)
    j = 0
    for n in range(N):
        if S[n] == num[j]:
            j += 1
        if j == 3:
            break
    if j == 3:
        cnt += 1
print(cnt)

Fixed submission:
N = int(input())
S = input()
cnt = 0
for i in range(1000):
    num = ''
    num += str(i // 100)
    num += str((i // 10) % 10)
    num += str(i % 10)
    j = 0
    for n in range(N):
        if S[n] == num[j]:
            j += 1
        if j == 3:
            break
    if j == 3:
        cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
S = input()
L = []
for s in S:
    L.append(s)
P = []
for n in itertools.combinations(L, 3):
    o = ''
    for i in list(n):
        o += i
    P.append(o)
P = set(P)
print(len(P))

Fixed submission:
N = int(input())
S = input()
cnt = 0
for i in range(1000):
    num = ''
    num += str(i // 100)
    num += str((i // 10) % 10)
    num += str(i % 10)
    j = 0
    for n in range(N):
        if S[n] == num[j]:
            j += 1
        if j == 3:
            break
    if j == 3:
        cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
cnt = 0
for i in range(1000):
    l = list()
    l.append(i // 100)
    l.append((i // 10) % 10)
    l.append(i % 10)
    f = 0
    for j in range(N):
        if int(S[j]) == l[f]:
            f += 1
        if f == 3:
            break
    if f == 3:
        cnt += 1
print(cnt)


Fixed submission:
N = int(input())
S = input()
cnt = 0
for i in range(1000):
    num = ''
    num += str(i // 100)
    num += str((i // 10) % 10)
    num += str(i % 10)
    j = 0
    for n in range(N):
        if S[n] == num[j]:
            j += 1
        if j == 3:
            break
    if j == 3:
        cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
cnt = 0
for i in range(1000):
    l = list()
    l.append(i // 100)
    l.append((i // 10) % 10)
    l.append(i % 10)
    f = 0
    for j in range(N):
        if int(S[j]) == l[f]:
            f += 1
        if f == 3:
            break
    if f == 3:
        cnt += 1
print(cnt)


Fixed submission:
N = int(input())
S = input()
cnt = 0
for i in range(1000):
    num = ''
    num += str(i // 100)
    num += str((i // 10) % 10)
    num += str(i % 10)
    j = 0
    for n in range(N):
        if S[n] == num[j]:
            j += 1
        if j == 3:
            break
    if j == 3:
        cnt += 1
print(cnt)