Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = list(input().split())
q = input()
T = input().split()
 
count = 0
for key in T:
    U = S + [key]
    i = 0
    while U[i] != key:
        i = i+1
    if i != n:
        count = count + 1
print(count)

Fixed submission:
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
 
count = 0
for key in T:
    left = 0
    right = n
    while left < right:
        mid = (right + left) // 2
        if S[mid] == key:
            count = count + 1
            break
        if key < S[mid]:
            right = mid
        else:
            left = mid + 1
print(count)

Buggy python submission (verdict: Runtime Error):
n = int(input())
S = map(int, input().split())
q = int(input())
T = map(int, input().split())
 
count = 0
for key in T:
    left = 0
    right = n
    while left < right
        mid = (right - left) // 2
        if S[mid] == key:
            count = count + 1
            break
        else if key < S[mid]
            right = mid
        else
            left = mid + 1
print(count)

Fixed submission:
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
 
count = 0
for key in T:
    left = 0
    right = n
    while left < right:
        mid = (right + left) // 2
        if S[mid] == key:
            count = count + 1
            break
        if key < S[mid]:
            right = mid
        else:
            left = mid + 1
print(count)

Buggy python submission (verdict: Runtime Error):
n = int(input())
S = map(int, input().split())
q = int(input())
T = map(int, input().split())
 
count = 0
for key in T:
    left = 0
    right = n
    while left < right
        mid = (right - left) // 2
        if S[mid] == key:
            count = count + 1
            break
        else if key < S[mid]:
            right = mid
        else:
            left = mid + 1
print(count)

Fixed submission:
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
 
count = 0
for key in T:
    left = 0
    right = n
    while left < right:
        mid = (right + left) // 2
        if S[mid] == key:
            count = count + 1
            break
        if key < S[mid]:
            right = mid
        else:
            left = mid + 1
print(count)

Buggy python submission (verdict: Runtime Error):
n = int(input())
S = map(int, input().split())
q = int(input())
T = map(int, input().split())
 
count = 0
for key in T:
    left = 0
    right = n
    while left < right:
        mid = (right - left) // 2
        if S[mid] == key:
            count = count + 1
            break
        else if key < S[mid]:
            right = mid
        else:
            left = mid + 1
print(count)

Fixed submission:
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
 
count = 0
for key in T:
    left = 0
    right = n
    while left < right:
        mid = (right + left) // 2
        if S[mid] == key:
            count = count + 1
            break
        if key < S[mid]:
            right = mid
        else:
            left = mid + 1
print(count)

Buggy python submission (verdict: Runtime Error):
n = int(input())
S = map(int, input().split())
q = int(input())
T = map(int, input().split())
 
count = 0
for key in T:
    left = 0
    right = n
    while left < right:
        mid = (right - left) // 2
        if S[mid] == key:
            count = count + 1
            break
        elif key < S[mid]:
            right = mid
        else:
            left = mid + 1
print(count)

Fixed submission:
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
 
count = 0
for key in T:
    left = 0
    right = n
    while left < right:
        mid = (right + left) // 2
        if S[mid] == key:
            count = count + 1
            break
        if key < S[mid]:
            right = mid
        else:
            left = mid + 1
print(count)

Buggy python submission (verdict: Runtime Error):
n = int(input())
S = map(int, input().split())
q = int(input())
T = map(int, input().split())
 
count = 0
for key in T:
    left = 0
    right = n
    while left < right:
        mid = (right - left) // 2
        if S[mid] == key:
            count = count + 1
            break
        if key < S[mid]:
            right = mid
        else:
            left = mid + 1
print(count)

Fixed submission:
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
 
count = 0
for key in T:
    left = 0
    right = n
    while left < right:
        mid = (right + left) // 2
        if S[mid] == key:
            count = count + 1
            break
        if key < S[mid]:
            right = mid
        else:
            left = mid + 1
print(count)

Buggy python submission (verdict: Runtime Error):

 
count = 0
for key in T:
    left = 0
    right = n
    while left < right:
        mid = (right - left) // 2
        if S[mid] == key:
            count = count + 1
            break
        if key < S[mid]:
            right = mid
        else:
            left = mid + 1
print(count)

Fixed submission:
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
 
count = 0
for key in T:
    left = 0
    right = n
    while left < right:
        mid = (right + left) // 2
        if S[mid] == key:
            count = count + 1
            break
        if key < S[mid]:
            right = mid
        else:
            left = mid + 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = map(int, input().split())
 
count = 0
for key in T:
    left = 0
    right = n
    while left < right:
        mid = (right - left) // 2
        if S[mid] == key:
            count = count + 1
            break
        if key < S[mid]:
            right = mid
        else:
            left = mid + 1
print(count)

Fixed submission:
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
 
count = 0
for key in T:
    left = 0
    right = n
    while left < right:
        mid = (right + left) // 2
        if S[mid] == key:
            count = count + 1
            break
        if key < S[mid]:
            right = mid
        else:
            left = mid + 1
print(count)