Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
l = input()
dp = [0]*1110
qp = [0]*1110
L = []
#print('###############')
def bfs(i,x,y):
	#print(i,x)
	if y == 3:
		qp[int(x)] = 1
		return 0
	else:
		for j in range(i,a):
			if x+str(l[j]) not in L:bfs(j+1,x+str(l[j]),y+1)
			L.append(x+str(l[j]))
bfs(0,'',0)
print(sum(qp))

Fixed submission:
a = int(input())
b = input()
ans = 0
for i in range(1000):
	T = '0'*(3-len(str(i)))
	t = T+ str(i)
	I = 0
	while I < 3:
		for j in b:
			#if t == '022':print(I,t[I],j)
			if I == 3:
				break
			if t[I] == j:I+=1
			#if t == '022':print(I,j)
		
		if I == 3: 
			#print(t)
			ans +=1
		break
print(ans)

Buggy python submission (verdict: Runtime Error):
a = int(input())
l = input()
dp = [0]*1110
qp = [0]*1110
ans = 0
#print('###############')
def bfs(i,x,y):
	#print(i,x)
	if y == 3:
		ans +=1
		return 0
	else:
		for j in range(i,a):
			if int(x+str(l[j])) != 1:bfs(j+1,x+str(l[j]),y+1)
			dp[int(x+str(l[j]))] = 1
bfs(0,'',0)
print(ans)

Fixed submission:
a = int(input())
b = input()
ans = 0
for i in range(1000):
	T = '0'*(3-len(str(i)))
	t = T+ str(i)
	I = 0
	while I < 3:
		for j in b:
			#if t == '022':print(I,t[I],j)
			if I == 3:
				break
			if t[I] == j:I+=1
			#if t == '022':print(I,j)
		
		if I == 3: 
			#print(t)
			ans +=1
		break
print(ans)

Buggy python submission (verdict: Runtime Error):
a = int(input())
l = input()
dp = [0]*1110
qp = [0]*1110
ans = 0
#print('###############')
def bfs(i,x,y):
	#print(i,x)
	if y == 3:
		ans +=1
		return 0
	else:
		for j in range(i,a):
			if int(x+str(l[j])) != 1:bfs(j+1,x+str(l[j]),y+1)
			dp[int(x+str(l[j]))] = 1
bfs(0,'',0)
print(sum(qp))

Fixed submission:
a = int(input())
b = input()
ans = 0
for i in range(1000):
	T = '0'*(3-len(str(i)))
	t = T+ str(i)
	I = 0
	while I < 3:
		for j in b:
			#if t == '022':print(I,t[I],j)
			if I == 3:
				break
			if t[I] == j:I+=1
			#if t == '022':print(I,j)
		
		if I == 3: 
			#print(t)
			ans +=1
		break
print(ans)

Buggy python submission (verdict: Runtime Error):
a = int(input())
l = input()
dp = [0]*1110
qp = [0]*1110
ans = 0
#print('###############')
def bfs(i,x,y):
	#print(i,x)
	if y == 3:
		ans +=1
		return 0
	else:
		for j in range(i,a):
			if int(x+str(l[j])) != 1:bfs(j+1,x+str(l[j]),y+1)
			dp[int(x+str(l[j]))] = 1
bfs(0,'',0)
print(sum(qp))

Fixed submission:
a = int(input())
b = input()
ans = 0
for i in range(1000):
	T = '0'*(3-len(str(i)))
	t = T+ str(i)
	I = 0
	while I < 3:
		for j in b:
			#if t == '022':print(I,t[I],j)
			if I == 3:
				break
			if t[I] == j:I+=1
			#if t == '022':print(I,j)
		
		if I == 3: 
			#print(t)
			ans +=1
		break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
l = input()
dp = [0]*1010
#print('###############')
def bfs(i,x,y):
	if y == 3:
		dp[int(x)] = 1
	else:
		for j in range(i,a):
			bfs(j+1,x+str(l[j]),y+1)
bfs(0,'',0)
print(sum(dp))

Fixed submission:
a = int(input())
b = input()
ans = 0
for i in range(1000):
	T = '0'*(3-len(str(i)))
	t = T+ str(i)
	I = 0
	while I < 3:
		for j in b:
			#if t == '022':print(I,t[I],j)
			if I == 3:
				break
			if t[I] == j:I+=1
			#if t == '022':print(I,j)
		
		if I == 3: 
			#print(t)
			ans +=1
		break
print(ans)