Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()
ans=0
a=[0]*3
f=0

for a[0] in range(10):
    for a[1] in range(10):
        for a[2] in range(10):
            #print("pass=",a[0],a[1],a[2])
            f=0
            for ss in s:
                #print(ss,a[f],f)
                if ss == str(a[f]):
                    f+=1
                    if f==3:
                        ans+=1
                        break
print(ans)


Fixed submission:
n=int(input())
s=input()
ans=0

for ii in range(1000):
    v = str(ii).zfill(3)
    start=0
    f=0
    
    for j in range(3):
        idx=s.find(v[j],start)
        if idx > -1:
            start = idx + 1
            f+=1
        else:
            break

    if f == 3:
        ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()
ans=0
a=[0]*3
f=0

for a[0] in range(10):
    for a[1] in range(10):
        for a[2] in range(10):
            #print("pass=",a[0],a[1],a[2])
            f=0
            for ss in s:
                #print(ss,a[f],f)
                if int(ss) == a[f]:
                    f+=1
                    if f==3:
                        ans+=1
                        break
print(ans)


Fixed submission:
n=int(input())
s=input()
ans=0

for ii in range(1000):
    v = str(ii).zfill(3)
    start=0
    f=0
    
    for j in range(3):
        idx=s.find(v[j],start)
        if idx > -1:
            start = idx + 1
            f+=1
        else:
            break

    if f == 3:
        ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

n=int(input())
s=input()
ans=0

for ii in range(1000):
    v = str(ii).zfill(3)
    #print(v[0])
    #s2=s
    #print("s=",v)
    start=0
    for j in range(3):
        f=0
        for i in range(start,n):
            if s[i] == v[j]:
                start=i+1
                f=1
                #print("aa",s2)
                break

        if f == 0 :
            break

    if f == 1:
        ans += 1
        #print(v)

print(ans)


Fixed submission:
n=int(input())
s=input()
ans=0

for ii in range(1000):
    v = str(ii).zfill(3)
    start=0
    f=0
    
    for j in range(3):
        idx=s.find(v[j],start)
        if idx > -1:
            start = idx + 1
            f+=1
        else:
            break

    if f == 3:
        ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

n=input()
s=input()
ans=0

for ii in range(1000):
    v = str(ii).zfill(3)
    #print(v[0])
    s2=s
    #print("s=",v)
    for j in range(3):
        f=0
        for i in range(len(s2)):
            if s2[i] == v[j]:
                s2=s2[i+1:]
                f=1
                #print("aa",s2)
                break

        if f == 0 :
            break

    if f == 1:
        ans += 1
        #print(v)

print(ans)


Fixed submission:
n=int(input())
s=input()
ans=0

for ii in range(1000):
    v = str(ii).zfill(3)
    start=0
    f=0
    
    for j in range(3):
        idx=s.find(v[j],start)
        if idx > -1:
            start = idx + 1
            f+=1
        else:
            break

    if f == 3:
        ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import re
n0=input()
s=input()
ans=0

for i in range(1000):
    n = str(i).zfill(3)
#    print(n[0])
    p = ".*"+ n[0] + ".*" + n[1] + ".*" + n[2] +".*"
    if re.match(p,s):
        ans += 1
print(ans)


Fixed submission:
n=int(input())
s=input()
ans=0

for ii in range(1000):
    v = str(ii).zfill(3)
    start=0
    f=0
    
    for j in range(3):
        idx=s.find(v[j],start)
        if idx > -1:
            start = idx + 1
            f+=1
        else:
            break

    if f == 3:
        ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import re
n0=input()
s=input()
ans=0

for i in range(1000):
    n = str(i).zfill(3)
#    print(n[0])
    p = ".*"+ n[0] + ".*" + n[1] + ".*" + n[2] +".*"
    if re.search(p,s):
        ans += 1
print(ans)


Fixed submission:
n=int(input())
s=input()
ans=0

for ii in range(1000):
    v = str(ii).zfill(3)
    start=0
    f=0
    
    for j in range(3):
        idx=s.find(v[j],start)
        if idx > -1:
            start = idx + 1
            f+=1
        else:
            break

    if f == 3:
        ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
import re
n0=input()
s=input()
ans=0

for i in range(1000):
    n = str(i).zfill(3)
#    print(n[0])
    p = f".*{n[0]}.*{n[1]}.*{n[2]}.*"
    if re.search(p,s):
        ans += 1
print(ans)


Fixed submission:
n=int(input())
s=input()
ans=0

for ii in range(1000):
    v = str(ii).zfill(3)
    start=0
    f=0
    
    for j in range(3):
        idx=s.find(v[j],start)
        if idx > -1:
            start = idx + 1
            f+=1
        else:
            break

    if f == 3:
        ans += 1

print(ans)