Buggy python submission (verdict: Time Limit Exceeded):
n = input()
s = input()

n = int(n)

allnum = set(range(0, 1000))
ans = []
counts = 0


checked_i = []
for i in range(n - 2):
    if i in checked_i:
        continue
    else:
        checked_i.append(i)
    
    checked_j = []
    for j in range(i + 1, n - 1):
        if j in checked_j:
            continue
        else:
            checked_j.append(j)
        # checked_j.append(j)

        num = int(s[i]) * 100 + int(s[j]) * 10

        if num in ans:
            continue
        else:
            ans.append(num)

            saigo_cnt = len(set([int(s[k]) for k in range(j + 1, n)]))
            counts += saigo_cnt

print(counts)


Fixed submission:
n = input()
s = str(input())
n = int(n)

ans_count =0

for i in range(10):
    for j in range(10):
        for k in range(10):
            i_pos = s.find(str(i))

            if i_pos < 0:
                continue

            j_pos = s.find(str(j),i_pos+1)

            if j_pos < 0:
                continue

            k_pos = s.find(str(k), j_pos +1)

            if k_pos < 0:
                continue

            ans_count += 1

print(ans_count)

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
s = input()

n = int(n)

allnum = set(range(0, 1000))
ans = []
counts = 0



for i in range(n - 2):
    checked_j = []
    for j in range(i + 1, n - 1):
        if j in checked_j:
            continue
        else:
            checked_j.append(j)
        # checked_j.append(j)

        num = int(s[i]) * 100 + int(s[j]) * 10

        if num in ans:
            continue
        else:
            ans.append(num)

            saigo_cnt = len(set([int(s[k]) for k in range(j + 1, n)]))
            counts += saigo_cnt

print(counts)


Fixed submission:
n = input()
s = str(input())
n = int(n)

ans_count =0

for i in range(10):
    for j in range(10):
        for k in range(10):
            i_pos = s.find(str(i))

            if i_pos < 0:
                continue

            j_pos = s.find(str(j),i_pos+1)

            if j_pos < 0:
                continue

            k_pos = s.find(str(k), j_pos +1)

            if k_pos < 0:
                continue

            ans_count += 1

print(ans_count)

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
s = input()

n = int(n)

allnum = set(range(0, 1000))
ans = []
counts = 0

for i in range(n - 2):
    for j in range(i + 1, n - 1):
        num = int(s[i]) * 100 + int(s[j]) * 10

        #
        # saigo = set([int(k) for k in s[j + 1:n]])
        # saigo_cnt = len(saigo)

        if num in ans:
            continue
        else:
            ans.append(num)

            saigo_cnt = len(set([int(s[k]) for k in range(j + 1, n)]))
            counts += saigo_cnt

print(counts)


Fixed submission:
n = input()
s = str(input())
n = int(n)

ans_count =0

for i in range(10):
    for j in range(10):
        for k in range(10):
            i_pos = s.find(str(i))

            if i_pos < 0:
                continue

            j_pos = s.find(str(j),i_pos+1)

            if j_pos < 0:
                continue

            k_pos = s.find(str(k), j_pos +1)

            if k_pos < 0:
                continue

            ans_count += 1

print(ans_count)

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
s = input()

n = int(n)

allnum = set(range(0, 1000))
ans = []

for i in range(n - 2):
    for j in range(i + 1, n - 1):
        for k in range(j + 1, n):
            num = int(s[i]) * 100 + int(s[j]) * 10 + int(s[k])

            if num in allnum and num not in ans:
                ans.append(num)

print(len(ans))

Fixed submission:
n = input()
s = str(input())
n = int(n)

ans_count =0

for i in range(10):
    for j in range(10):
        for k in range(10):
            i_pos = s.find(str(i))

            if i_pos < 0:
                continue

            j_pos = s.find(str(j),i_pos+1)

            if j_pos < 0:
                continue

            k_pos = s.find(str(k), j_pos +1)

            if k_pos < 0:
                continue

            ans_count += 1

print(ans_count)

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
s = input()

n = int(n)

allnum = list(range(0, 1000))

for i in range(n - 2):
    for j in range(i + 1, n - 1):
        for k in range(j + 1, n):
            num = int(s[i]) * 100 + int(s[j]) * 10 + int(s[k])
            # print(num)

            try:
                allnum.remove(num)
            except:
                pass

print(1000 - len(allnum))

Fixed submission:
n = input()
s = str(input())
n = int(n)

ans_count =0

for i in range(10):
    for j in range(10):
        for k in range(10):
            i_pos = s.find(str(i))

            if i_pos < 0:
                continue

            j_pos = s.find(str(j),i_pos+1)

            if j_pos < 0:
                continue

            k_pos = s.find(str(k), j_pos +1)

            if k_pos < 0:
                continue

            ans_count += 1

print(ans_count)

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
s = input()

n = int(n)

ans = []
counts = 0

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

        if s[i] + s[j] in ans:
            continue
        else:
            counts += len(set(s[j + 1: n]))
            ans.append(s[i] + s[j])

        # for k in range(j + 1, n):
        #     ans.append(s[i] + s[j] + s[k])

# ans = list(set(ans))
print(counts)

Fixed submission:
n = input()
s = str(input())
n = int(n)

ans_count =0

for i in range(10):
    for j in range(10):
        for k in range(10):
            i_pos = s.find(str(i))

            if i_pos < 0:
                continue

            j_pos = s.find(str(j),i_pos+1)

            if j_pos < 0:
                continue

            k_pos = s.find(str(k), j_pos +1)

            if k_pos < 0:
                continue

            ans_count += 1

print(ans_count)

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
s = input()

n = int(n)

ans = []

for i in range(n - 2):
    for j in range(i+1, n - 1):
        for k in range(j+1, n):
            ans.append(s[i]+s[j]+s[k])
            # print(s[i]+s[j]+s[k])

ans = list(set(ans))
print(len(ans))

Fixed submission:
n = input()
s = str(input())
n = int(n)

ans_count =0

for i in range(10):
    for j in range(10):
        for k in range(10):
            i_pos = s.find(str(i))

            if i_pos < 0:
                continue

            j_pos = s.find(str(j),i_pos+1)

            if j_pos < 0:
                continue

            k_pos = s.find(str(k), j_pos +1)

            if k_pos < 0:
                continue

            ans_count += 1

print(ans_count)