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

N=int(input())
S=input()
t=["0","1","2","3","4","5","6","7","8","9"]

u=product(t,repeat=3)
ans=0

for com in u:
  x_flag=False
  y_flag=False
  x=com[0]
  y=com[1]
  z=com[2]
    
  for i in range(N):
    if S[i]==x:
      x_flag=True
      break
  if x_flag:
    for j in range(i+1,N):
      if S[j]==y:
        y_flag=True
        break
  if y_flag:
    for k in range(j+1,N):
      if S[k]==z:
        ans+=1
        break
        
print(ans)


Fixed submission:
from itertools import product

N=int(input())
S=list(input())
t=["0","1","2","3","4","5","6","7","8","9"]

u=product(t,repeat=3)
ans=0
for com in u:
  x=com[0]
  y=com[1]
  z=com[2]
  
  if x in set(S):
    idx_x = S.index(x)
    tmp1 = S[idx_x+1:]
    if y in set(tmp1):
      idx_y = tmp1.index(y)
      tmp2 = tmp1[idx_y+1:]
      if z in set(tmp2):
        ans+=1
        continue
        
print(ans)

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

N=int(input())
S=input()
t=["0","1","2","3","4","5","6","7","8","9"]

u=product(t,repeat=3)
ans=0
for com in u:
  x_search=True
  y_search=True
  flag=False
  x=com[0]
  y=com[1]
  z=com[2]
    
  for i in range(N):
    if x_search and S[i]==x:
      x_search=False
      for j in range(i+1,N):
        if y_search and S[j]==y:
          y_search=False
          for k in range(j+1,N):
            if S[k]==z:
              flag=True
              break
  if flag:
    ans+=1
print(ans)


Fixed submission:
from itertools import product

N=int(input())
S=list(input())
t=["0","1","2","3","4","5","6","7","8","9"]

u=product(t,repeat=3)
ans=0
for com in u:
  x=com[0]
  y=com[1]
  z=com[2]
  
  if x in set(S):
    idx_x = S.index(x)
    tmp1 = S[idx_x+1:]
    if y in set(tmp1):
      idx_y = tmp1.index(y)
      tmp2 = tmp1[idx_y+1:]
      if z in set(tmp2):
        ans+=1
        continue
        
print(ans)

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

N=int(input())
S=input()
t=["0","1","2","3","4","5","6","7","8","9"]

u=product(t,repeat=3)
ans=0
for com in u:
  flag=False
  x=com[0]
  y=com[1]
  z=com[2]
  for i in range(N):
    if S[i]==x:
      for j in range(i+1,N):
        if S[j]==y:
          tmp=S[j+1:]
          if z in tmp:
            flag=True
            break
      else:
        break
  if flag:
    ans+=1
print(ans)


Fixed submission:
from itertools import product

N=int(input())
S=list(input())
t=["0","1","2","3","4","5","6","7","8","9"]

u=product(t,repeat=3)
ans=0
for com in u:
  x=com[0]
  y=com[1]
  z=com[2]
  
  if x in set(S):
    idx_x = S.index(x)
    tmp1 = S[idx_x+1:]
    if y in set(tmp1):
      idx_y = tmp1.index(y)
      tmp2 = tmp1[idx_y+1:]
      if z in set(tmp2):
        ans+=1
        continue
        
print(ans)

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

N=int(input())
S=input()
t=["0","1","2","3","4","5","6","7","8","9"]

u=product(t,repeat=3)
ans=0
for com in u:
  flag=False
  x=com[0]
  y=com[1]
  z=com[2]
  for i in range(N):
    if S[i]==x:
      for j in range(i+1,N):
        if S[j]==y:
          tmp=S[j+1:]
          if z in tmp:
            flag=True
            break
  if flag:
    ans+=1
print(ans)

Fixed submission:
from itertools import product

N=int(input())
S=list(input())
t=["0","1","2","3","4","5","6","7","8","9"]

u=product(t,repeat=3)
ans=0
for com in u:
  x=com[0]
  y=com[1]
  z=com[2]
  
  if x in set(S):
    idx_x = S.index(x)
    tmp1 = S[idx_x+1:]
    if y in set(tmp1):
      idx_y = tmp1.index(y)
      tmp2 = tmp1[idx_y+1:]
      if z in set(tmp2):
        ans+=1
        continue
        
print(ans)

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

N=int(input())
S=input()
t=["0","1","2","3","4","5","6","7","8","9"]

u=product(t,repeat=3)
ans=0
for com in u:
  flag=False
  x=com[0]
  y=com[1]
  z=com[2]
  for i in range(N):
    if S[i]==x:
      for j in range(i+1,N):
        if S[j]==y:
          for k in range(j+1,N):
            if S[k]==z:
              flag=True
  if flag:
    ans+=1
print(ans)

Fixed submission:
from itertools import product

N=int(input())
S=list(input())
t=["0","1","2","3","4","5","6","7","8","9"]

u=product(t,repeat=3)
ans=0
for com in u:
  x=com[0]
  y=com[1]
  z=com[2]
  
  if x in set(S):
    idx_x = S.index(x)
    tmp1 = S[idx_x+1:]
    if y in set(tmp1):
      idx_y = tmp1.index(y)
      tmp2 = tmp1[idx_y+1:]
      if z in set(tmp2):
        ans+=1
        continue
        
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
A = []
B = {}

#for i in range(N):
#  t=int(S[i])
#  if t not in B:
#    B[t]=1
#    A.append(t)
#  elif B[t]<3:
#    B[t]+=1
#    A.append(t)
#  else:
#    pass

for i in range(N):
  A.append(S[i])
C=len(A)
D=set()

for i in range(0,C-2):
  for j in range(i+1,C-1):
    for k in range(j+1,C):
      strg=str(A[i])+str(A[j])+str(A[k])
      D.add(strg)
                 
#print(D)
print(len(D))

Fixed submission:
from itertools import product

N=int(input())
S=list(input())
t=["0","1","2","3","4","5","6","7","8","9"]

u=product(t,repeat=3)
ans=0
for com in u:
  x=com[0]
  y=com[1]
  z=com[2]
  
  if x in set(S):
    idx_x = S.index(x)
    tmp1 = S[idx_x+1:]
    if y in set(tmp1):
      idx_y = tmp1.index(y)
      tmp2 = tmp1[idx_y+1:]
      if z in set(tmp2):
        ans+=1
        continue
        
print(ans)