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

D=[0]*1000

for i in range(1000):
    a=str(i//100)
    b=str((i//10)%10)
    c=str(i%10)
    f=0
    for j in S:
        if(f==2 and c==j):
            D[i]=1
            break
        elif(f==1 and b==j):
            f=2
        elif(f==0 and a==j):
            f=1
print(sum(D))



Fixed submission:
n = int(input())
s = input()
ans = 0
for a in range(10):
  for b in range(10):
    for c in range(10):
      a, b, c = str(a), str(b), str(c)
      a_find = s.find(a)
      if a_find == -1:
        continue
      b_find = s.find(b, a_find + 1)
      if b_find == -1:
        continue
      c_find = s.find(c, b_find + 1)
      if c_find == -1:
        continue
      ans += 1
print(ans)

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

D=[0]*100
C=0
W=[0]*10
R=len(set(S))**3
u=0
for i in range(N-2):
    if(C==R):
        break
    if(W[int(S[i])]<10):
        u=len(set(S[i+1:N]))
        for j in range(i+1,N-1):
            if(W[int(S[i])]==u):
                break
            s=str(S[i])+str(S[j])
            if(D[int(s)]==0):
                D[int(s)]=1
                W[int(S[i])]+=1
                C+=len(set(S[j+1:N]))
print(C)



Fixed submission:
n = int(input())
s = input()
ans = 0
for a in range(10):
  for b in range(10):
    for c in range(10):
      a, b, c = str(a), str(b), str(c)
      a_find = s.find(a)
      if a_find == -1:
        continue
      b_find = s.find(b, a_find + 1)
      if b_find == -1:
        continue
      c_find = s.find(c, b_find + 1)
      if c_find == -1:
        continue
      ans += 1
print(ans)

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

D=[0]*100
C=0
W=[0]*10
R=len(set(S))**3

for i in range(N-2):
    if(C==R):
        break
    if(W[int(S[i])]<10):
        for j in range(i+1,N-1):
            if(W[int(S[i])]==10):
                break
            s=str(S[i])+str(S[j])
            if(D[int(s)]==0):
                D[int(s)]=1
                W[int(S[i])]+=1
                C+=len(set(S[j+1:N]))
print(C)



Fixed submission:
n = int(input())
s = input()
ans = 0
for a in range(10):
  for b in range(10):
    for c in range(10):
      a, b, c = str(a), str(b), str(c)
      a_find = s.find(a)
      if a_find == -1:
        continue
      b_find = s.find(b, a_find + 1)
      if b_find == -1:
        continue
      c_find = s.find(c, b_find + 1)
      if c_find == -1:
        continue
      ans += 1
print(ans)

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

D=[0]*100
C=0
W=[0]*10
R=len(set(S))**3

for i in range(N-2):
    if(C==R):
        break
    if(W[int(S[i])]<10):
        for j in range(i+1,N-1):
            s=str(S[i])+str(S[j])
            if(D[int(s)]==0):
                D[int(s)]=1
                W[int(S[i])]+=1
                C+=len(set(S[j+1:N]))
print(C)



Fixed submission:
n = int(input())
s = input()
ans = 0
for a in range(10):
  for b in range(10):
    for c in range(10):
      a, b, c = str(a), str(b), str(c)
      a_find = s.find(a)
      if a_find == -1:
        continue
      b_find = s.find(b, a_find + 1)
      if b_find == -1:
        continue
      c_find = s.find(c, b_find + 1)
      if c_find == -1:
        continue
      ans += 1
print(ans)

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

L=[0]*9
D=[0]*100
C=0
R=len(set(S))**3

for i in range(N-2):
    if(C==R):
        break
    for j in range(i+1,N-1):
        s=str(S[i])+str(S[j])
        if(D[int(s)]==0):
            D[int(s)]=1
            C+=len(set(S[j+1:N]))
print(C)



Fixed submission:
n = int(input())
s = input()
ans = 0
for a in range(10):
  for b in range(10):
    for c in range(10):
      a, b, c = str(a), str(b), str(c)
      a_find = s.find(a)
      if a_find == -1:
        continue
      b_find = s.find(b, a_find + 1)
      if b_find == -1:
        continue
      c_find = s.find(c, b_find + 1)
      if c_find == -1:
        continue
      ans += 1
print(ans)

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

L=[0]*9
D=[0]*100
C=0
for i in range(N-2):
    if(C==1000):
        break
    for j in range(i+1,N-1):
        s=str(S[i])+str(S[j])
        if(D[int(s)]==0):
            D[int(s)]=1
            C+=len(set(S[j+1:N]))
print(C)



Fixed submission:
n = int(input())
s = input()
ans = 0
for a in range(10):
  for b in range(10):
    for c in range(10):
      a, b, c = str(a), str(b), str(c)
      a_find = s.find(a)
      if a_find == -1:
        continue
      b_find = s.find(b, a_find + 1)
      if b_find == -1:
        continue
      c_find = s.find(c, b_find + 1)
      if c_find == -1:
        continue
      ans += 1
print(ans)

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

L=[0]*9
D=[0]*100
C=0
for i in range(N-2):
    for j in range(i+1,N-1):
        s=str(S[i])+str(S[j])
        if(D[int(s)]==0):
            D[int(s)]=1
            C+=len(set(S[j+1:N]))
print(C)



Fixed submission:
n = int(input())
s = input()
ans = 0
for a in range(10):
  for b in range(10):
    for c in range(10):
      a, b, c = str(a), str(b), str(c)
      a_find = s.find(a)
      if a_find == -1:
        continue
      b_find = s.find(b, a_find + 1)
      if b_find == -1:
        continue
      c_find = s.find(c, b_find + 1)
      if c_find == -1:
        continue
      ans += 1
print(ans)

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

L=[0]*9
D={}
C=0
for i in range(N-2):
    for j in range(i+1,N-1):
        s=str(S[i])+str(S[j])
        if(D.get(s,None)==None):
            D[s]=1
            C+=len(set(S[j+1:N]))
print(C)



Fixed submission:
n = int(input())
s = input()
ans = 0
for a in range(10):
  for b in range(10):
    for c in range(10):
      a, b, c = str(a), str(b), str(c)
      a_find = s.find(a)
      if a_find == -1:
        continue
      b_find = s.find(b, a_find + 1)
      if b_find == -1:
        continue
      c_find = s.find(c, b_find + 1)
      if c_find == -1:
        continue
      ans += 1
print(ans)

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

L=[0]*1000
D={}

for i in range(N-2):
    for j in range(i+1,N-1):
        s=str(S[i])+str(S[j])
        if(D.get(int(s),None)==None):
            D[int(s)]=1
            for k in range(j+1,N):
                t=str(S[i])+str(S[j])+str(S[k])
                L[int(t)]=1
print(sum(L))



Fixed submission:
n = int(input())
s = input()
ans = 0
for a in range(10):
  for b in range(10):
    for c in range(10):
      a, b, c = str(a), str(b), str(c)
      a_find = s.find(a)
      if a_find == -1:
        continue
      b_find = s.find(b, a_find + 1)
      if b_find == -1:
        continue
      c_find = s.find(c, b_find + 1)
      if c_find == -1:
        continue
      ans += 1
print(ans)