Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()
S=list(map(int,S))
ans=0
for s in range(1000):
      A=s//100
      B=(s-A*100)//10
      C=s-A*100-B*10
      isOne=0
      isTen=0
      isHundred=0
      for i in range(N) :
        if isOne==0:
          if S[i]==A: 
            isOne=1
        elif isTen==0:
          if S[i]==B: 
            isTen=1
        elif isHundred==0:
          if S[i]==C:
            isHundred=1
            ans+=1
        else:
          break

print(ans)

Fixed submission:
N=int(input())
S=input()
S=list(map(int,S))
ans=0
for s in range(1000):
      A=s//100
      B=(s-A*100)//10
      C=s-A*100-B*10
      isOne=0
      isTen=0
      isHundred=0
      for i in range(N) :
        if isOne==0:
          if S[i]==A: 
            isOne=1
        elif isTen==0:
          if S[i]==B: 
            isTen=1
        elif isHundred==0:
          if S[i]==C:
            isHundred=1
            ans+=1
        else:
          break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()

ans=0
for s in range(1000):
      s='{:0=3}'.format(s)
      isOne=0
      isTen=0
      isHundred=0
      for i in range(N) :
        if isOne==0:
          if S[i]==s[0]: 
            isOne=1
        elif isTen==0:
          if S[i]==s[1]: 
            isTen=1
        elif isHundred==0:
          if S[i]==s[2]:
            isHundred=1
            ans+=1
        else:
          break

print(ans)

Fixed submission:
N=int(input())
S=input()
S=list(map(int,S))
ans=0
for s in range(1000):
      A=s//100
      B=(s-A*100)//10
      C=s-A*100-B*10
      isOne=0
      isTen=0
      isHundred=0
      for i in range(N) :
        if isOne==0:
          if S[i]==A: 
            isOne=1
        elif isTen==0:
          if S[i]==B: 
            isTen=1
        elif isHundred==0:
          if S[i]==C:
            isHundred=1
            ans+=1
        else:
          break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()

ans=0
for i2 in range(10):
  for j in range(10):
    for k in range(10):
      s='{}{}{}'.format(i2,j,k)
      isOne=0
      isTen=0
      isHundred=0
      for i in range(N) :
        if isOne==0:
          if S[i]==s[0]: 
            isOne=1
        elif isTen==0:
          if S[i]==s[1]: 
            isTen=1
        elif isHundred==0:
          if S[i]==s[2]:
            isHundred=1
            ans+=1
        else:
          break

print(ans)

Fixed submission:
N=int(input())
S=input()
S=list(map(int,S))
ans=0
for s in range(1000):
      A=s//100
      B=(s-A*100)//10
      C=s-A*100-B*10
      isOne=0
      isTen=0
      isHundred=0
      for i in range(N) :
        if isOne==0:
          if S[i]==A: 
            isOne=1
        elif isTen==0:
          if S[i]==B: 
            isTen=1
        elif isHundred==0:
          if S[i]==C:
            isHundred=1
            ans+=1
        else:
          break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()



ans=0
for i2 in range(10):
  for j in range(10):
    for k in range(10):
      s='{}{}{}'.format(i2,j,k)
      isOne=0
      isTen=0
      isHundred=0
      for i in range(N) :
        if S[i]==s[0] and isOne==0:
          isOne=1
        elif S[i]==s[1] and isOne==1 and isTen==0:
          isTen=1
        elif S[i]==s[2] and isOne==1 and isTen==1 and isHundred==0:
          isHundred=1
      if isHundred==1:
        ans+=1

print(ans)

Fixed submission:
N=int(input())
S=input()
S=list(map(int,S))
ans=0
for s in range(1000):
      A=s//100
      B=(s-A*100)//10
      C=s-A*100-B*10
      isOne=0
      isTen=0
      isHundred=0
      for i in range(N) :
        if isOne==0:
          if S[i]==A: 
            isOne=1
        elif isTen==0:
          if S[i]==B: 
            isTen=1
        elif isHundred==0:
          if S[i]==C:
            isHundred=1
            ans+=1
        else:
          break

print(ans)

Buggy python submission (verdict: Runtime Error):
ans=0
for i in range(10):
  for j in range(10):
    for k in range(10):
      s='{}{}{}'.format(i,j,k)
      isOne=0
      isTen=0
      isHundred=0
      for i in range(N) :
        if S[i]==s[0] and isOne==0:
          isOne=1
        elif S[i]==s[1] and isOne==1 and isTen==0:
          isTen=1
        elif S[i]==s[2] and isOne==1 and isTen==1 and isHundred==0:
          isHundred=1
      if isHundred==1:
      ans+=1

print(ans)

Fixed submission:
N=int(input())
S=input()
S=list(map(int,S))
ans=0
for s in range(1000):
      A=s//100
      B=(s-A*100)//10
      C=s-A*100-B*10
      isOne=0
      isTen=0
      isHundred=0
      for i in range(N) :
        if isOne==0:
          if S[i]==A: 
            isOne=1
        elif isTen==0:
          if S[i]==B: 
            isTen=1
        elif isHundred==0:
          if S[i]==C:
            isHundred=1
            ans+=1
        else:
          break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()

pin={}

for i in range(10):
  for j in range(10):
    for k in range(10):
     pin['{}{}{}'.format(i,j,k)]='{}{}{}'.format(i,j,k)

ans=0
for key in pin:
  s=pin[key]
  isOne=0
  isTen=0
  isHundred=0
  for i in range(N) :
    if S[i]==s[0] and isOne==0:
      isOne=1
    elif S[i]==s[1] and isOne==1 and isTen==0:
      isTen=1
    elif S[i]==s[2] and isOne==1 and isTen==1 and isHundred==0:
      isHundred=1
  if isHundred==1:
    ans+=1

print(ans)

Fixed submission:
N=int(input())
S=input()
S=list(map(int,S))
ans=0
for s in range(1000):
      A=s//100
      B=(s-A*100)//10
      C=s-A*100-B*10
      isOne=0
      isTen=0
      isHundred=0
      for i in range(N) :
        if isOne==0:
          if S[i]==A: 
            isOne=1
        elif isTen==0:
          if S[i]==B: 
            isTen=1
        elif isHundred==0:
          if S[i]==C:
            isHundred=1
            ans+=1
        else:
          break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()

pin={}

l=len(S)
for i in range(10):
  for j in range(10):
    for k in range(10):
     pin['{}{}{}'.format(i,j,k)]='{}{}{}'.format(i,j,k)

ans=0
for key in pin:
  s=pin[key]
  flag=0
  start=0
  for i in range(N) :
    if S[i]==s[0]:
      start=i+1
      flag+=1
      break
  if flag==1:
    for j in range(start,N):
      if S[j]==s[1]:
        start=j+1
        flag+=1
        break
  if flag==2:
    for k in range(start,N):
      if S[k]==s[2]:
        flag+=1
        break
  if flag==3:
    ans+=1

print(ans)

Fixed submission:
N=int(input())
S=input()
S=list(map(int,S))
ans=0
for s in range(1000):
      A=s//100
      B=(s-A*100)//10
      C=s-A*100-B*10
      isOne=0
      isTen=0
      isHundred=0
      for i in range(N) :
        if isOne==0:
          if S[i]==A: 
            isOne=1
        elif isTen==0:
          if S[i]==B: 
            isTen=1
        elif isHundred==0:
          if S[i]==C:
            isHundred=1
            ans+=1
        else:
          break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()

pin={}

l=len(S)
for i in range(10):
  for j in range(10):
    for k in range(10):
     pin['{}{}{}'.format(i,j,k)]='{}{}{}'.format(i,j,k)

ans=0
for key in pin:
  s=pin[key]
  flag=0
  start=0
  for i in range(N) :
    if S[i]==s[0]:
      start=i+1
      flag+=1
      break
  for j in range(start,N):
    if S[j]==s[1]:
      start=j+1
      flag+=1
      break
  for k in range(start,N):
    if S[k]==s[2]:
      flag+=1
      break
  if flag==3:
    ans+=1

print(ans)

Fixed submission:
N=int(input())
S=input()
S=list(map(int,S))
ans=0
for s in range(1000):
      A=s//100
      B=(s-A*100)//10
      C=s-A*100-B*10
      isOne=0
      isTen=0
      isHundred=0
      for i in range(N) :
        if isOne==0:
          if S[i]==A: 
            isOne=1
        elif isTen==0:
          if S[i]==B: 
            isTen=1
        elif isHundred==0:
          if S[i]==C:
            isHundred=1
            ans+=1
        else:
          break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()

pin={}

l=len(S)
for i in range(10):
  for j in range(10):
    for k in range(10):
     pin['{}{}{}'.format(i,j,k)]='{}{}{}'.format(i,j,k)

ans=0
for key in pin:
  s=pin[key]
  flag=0
  for i in range(N) :
    if S[i]==s[0]:
      for j in range(i+1,N):
        if S[j]==s[1]:
           for k in range(j+1,N):
             if S[k]==s[2]:
               flag=1
  if flag==1:
    ans+=1
    
print(ans)

Fixed submission:
N=int(input())
S=input()
S=list(map(int,S))
ans=0
for s in range(1000):
      A=s//100
      B=(s-A*100)//10
      C=s-A*100-B*10
      isOne=0
      isTen=0
      isHundred=0
      for i in range(N) :
        if isOne==0:
          if S[i]==A: 
            isOne=1
        elif isTen==0:
          if S[i]==B: 
            isTen=1
        elif isHundred==0:
          if S[i]==C:
            isHundred=1
            ans+=1
        else:
          break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()

pin={}
#for i in range(10):
 # for j in range(10):
  #  for k in range(10):
   #   pin['{}{}{}'.format(i,j,k)]=0

l=len(S)
for i in range(l):
  for j in range(i+1,l):
    for k in range(j+1,l):
      s=S[i]+S[j]+S[k]
      pin[s]=1


ans=len(pin)

print(ans)

Fixed submission:
N=int(input())
S=input()
S=list(map(int,S))
ans=0
for s in range(1000):
      A=s//100
      B=(s-A*100)//10
      C=s-A*100-B*10
      isOne=0
      isTen=0
      isHundred=0
      for i in range(N) :
        if isOne==0:
          if S[i]==A: 
            isOne=1
        elif isTen==0:
          if S[i]==B: 
            isTen=1
        elif isHundred==0:
          if S[i]==C:
            isHundred=1
            ans+=1
        else:
          break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()

pin={}
for i in range(10):
  for j in range(10):
    for k in range(10):
      pin['{}{}{}'.format(i,j,k)]=0

l=len(S)
for i in range(l):
  for j in range(i+1,l):
    for k in range(j+1,l):
      s=S[i]+S[j]+S[k]
      pin[s]=1


ans=0
for i in pin:
  if pin[i]==1:
    ans+=1

print(ans)

Fixed submission:
N=int(input())
S=input()
S=list(map(int,S))
ans=0
for s in range(1000):
      A=s//100
      B=(s-A*100)//10
      C=s-A*100-B*10
      isOne=0
      isTen=0
      isHundred=0
      for i in range(N) :
        if isOne==0:
          if S[i]==A: 
            isOne=1
        elif isTen==0:
          if S[i]==B: 
            isTen=1
        elif isHundred==0:
          if S[i]==C:
            isHundred=1
            ans+=1
        else:
          break

print(ans)