Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
cnt = 0
for i in range(0,1000):
  if i >= 100:
    i = str(i)
  elif i >= 10:
    i = "0" + str(i)
  else:
    i = "00" + str(i)
  checker = 0
  for j in range(N):
    if S[j] == i[checker]:
      checker += 1
    if checker == 3:
      cnt += 1
      break
print(cnt)
      

Fixed submission:
N = int(input())
S = input()
count = 0
for i in range(0,1000):
  if i >= 100:
    t = str(i)
  elif i >= 10:
    t = "0"+str(i)
  else:
    t = "00"+str(i)
  ti = 0
  for j in range(N):
    if S[j] == t[ti]:
      ti += 1
      if ti == 3:
        count += 1
        break
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
cnt = 0
for i in range(0,1000):
  if i >= 100:
    i = str(i)
  elif i >= 10:
    i = "0" + str(i)
  else:
    i = "00" + str(i)
  checker = 0
  for j in range(N):
    if S[j] == i[checker]:
      checker += 1
      if checker == 3:
        cnt += 1
        break
print(cnt)
      

Fixed submission:
N = int(input())
S = input()
count = 0
for i in range(0,1000):
  if i >= 100:
    t = str(i)
  elif i >= 10:
    t = "0"+str(i)
  else:
    t = "00"+str(i)
  ti = 0
  for j in range(N):
    if S[j] == t[ti]:
      ti += 1
      if ti == 3:
        count += 1
        break
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
count = 0
for i in range(0,1000):
  if i >= 100:
    t = str(i)
  elif i >= 10:
    t = "0"+str(i)
  else:
    t = "00"+str(i)
  ti = 0
  for j in range(N):
    if S[j] == t[ti]:
      ti += 1
      if ti == 3:
        count += 1
        break
print(count)

Fixed submission:
N = int(input())
S = input()
count = 0
for i in range(0,1000):
  if i >= 100:
    t = str(i)
  elif i >= 10:
    t = "0"+str(i)
  else:
    t = "00"+str(i)
  ti = 0
  for j in range(N):
    if S[j] == t[ti]:
      ti += 1
      if ti == 3:
        count += 1
        break
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
count = 0
for i in range(0,1000):
  if i <= 9:
    j = "00"+str(i)
  elif i <= 99:
    j = "0"+str(i)
  else:
    j = str(i)
  check = False
  for k in range(N-2):
    if S[k] == j[0]:
      for n in range(k+1,N-1):
        if S[n] == j[1]:
          for m in range(n+1,N):
            if S[m] == j[2]:
              count += 1
              check = True
              break
          if check:
            break
      if check:
        break
print(count)   

Fixed submission:
N = int(input())
S = input()
count = 0
for i in range(0,1000):
  if i >= 100:
    t = str(i)
  elif i >= 10:
    t = "0"+str(i)
  else:
    t = "00"+str(i)
  ti = 0
  for j in range(N):
    if S[j] == t[ti]:
      ti += 1
      if ti == 3:
        count += 1
        break
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
pins = []
for i in range(0,N-2):
  for j in range(i+1,N-1):
    for k in range(j+1,N):
      pin = S[i]+S[j]+S[k]
      if pins.count(pin) == 0:
        pins.append(pin)
print(len(pins))

Fixed submission:
N = int(input())
S = input()
count = 0
for i in range(0,1000):
  if i >= 100:
    t = str(i)
  elif i >= 10:
    t = "0"+str(i)
  else:
    t = "00"+str(i)
  ti = 0
  for j in range(N):
    if S[j] == t[ti]:
      ti += 1
      if ti == 3:
        count += 1
        break
print(count)