Problem:
Search I You are given a sequence of n integers S and a sequence of different q integers T. Write a program which outputs C, the number of integers in T which are also in the set S. Input In the first line n is given. In the second line, n integers are given. In the third line q is given. Then, in the fourth line, q integers are given. Output Print C in a line. Constraints  n ≤ 10000  q ≤ 500  0 ≤ an element in S ≤ 10 9  0 ≤ an element in T ≤ 10 9  Sample Input 1 5
1 2 3 4 5
3
3 4 1 Sample Output 1 3 Sample Input 2 3
3 1 2
1
5 Sample Output 2 0 Sample Input 3 5
1 1 2 2 3
2
1 2 Sample Output 3 2 Notes

Solution (Python):
N = int(input())
S = list(map(int, input().split()))
Q = int(input())
T = list(map(int, input().split()))

match_count = 0
for i in T:
    for j in S:
        if i == j:
            match_count += 1
            break

print(str(match_count))

Solution (Python):
N = int(input())
S = list(map(int, input().split()))
Q = int(input())
T = list(map(int, input().split()))

match_count = 0
for i in T:
    if i in S:
        match_count += 1

print(str(match_count))

Solution (Python):

numberN=int(input())
arrayS=list(map(int,input().split()))

numberQ=int(input())
arrayT=list(map(int,input().split()))


def linearSearch(arrayS,arrayT,numberQ):
    machedNumber=0
    index=0
    while index<numberQ:
        if arrayT[index] in arrayS:
            machedNumber+=1
        index+=1
    print(machedNumber) 


linearSearch(arrayS,arrayT,numberQ)

Solution (Python):
def linear_search(search_list, target):
    i = 0
    search_list.append(target)
    while search_list[i] != target:
        i += 1
    if i == len(search_list) - 1:
        return -1
    else:
        return i

if __name__ == '__main__':
    n = int(input())
    S = [int(x) for x in input().split()]
    q = int(input())
    T = [int(x) for x in input().split()]
    count = 0

    for x in T:
        if linear_search(S, x) > -1:
            count += 1
    print(count)

Solution (Python):
n1 = int(input())
a1 = [int(x) for x in input().split()]
n2 = int(input())
a2 = [int(x) for x in input().split()]

res = set()

cnt = 0

for i in range(n1) :
    for j in range(n2) :
        if a1[i] == a2[j] :
            res.add(a1[i])
            
print(len(res))

Solution (Python):
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))


def linear_search(series, key):
    for x in series:
        if key == x:
            return 1
    return 0

cnt = 0
for t in T:
    cnt += linear_search(S, t)
print(cnt)

Solution (Python):
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
def liner_search(S, key):
    for i in S:
        if i == key:
            return True
    return False
print(sum(liner_search(S, key) for key in T))

Solution (Python):
n = int(input())
s = set(map(int, input().split()))
q = int(input())
t = set(map(int, input().split()))

ans = s & t
print(len(ans))

Solution (Python):
def main():
    _ = input()
    array_A = input().split()
    _ = input()
    array_B = input().split()

    array_intersection = set(array_A) & set(array_B)

    print(len(array_intersection))

    return


main()

Solution (Python):
def linear_search(num_list,target):
    for num in num_list:
        if num == target:
            return 1
    return 0

n = input()
num_list = list(map(int,input().split()))
q = input()
target_list = list(map(int,input().split()))
ans = 0

for target in target_list:
    ans += linear_search(num_list,target)
print(ans)

Solution (Python):
def linear_search(arr, key):
	arr.append(key)
	i = 0 
	while arr[i] != key:
		i += 1
		if i == n:
			return -1 
	return i 

n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
count = 0 
for i in range(q):
	if linear_search(S, T[i]) != -1:
		count += 1
print(str(count))

Solution (Python):
def linearSearch(A, n, key):
	i = 0
	A.append(key)
	while (A[i] != key):
		i += 1
	del A[n]

	return i != n


if __name__ == '__main__':
	
	n = int(input())
	L = list(map(int, input().split()))

	q = int(input())
	Key = list(map(int, input().split()))

	cnt = 0
	for i in range(q):
		if (linearSearch(L, n, Key[i])):
			cnt += 1

	print(cnt)

Solution (Python):
N = int(input())
S = [int(i) for i in input().split()]
q = int(input())
T = [int(i) for i in input().split()]

count = 0
for t in T:
    for s in S:
        if t == s:
            count += 1
            break
print(count)

Solution (Python):
N = int(input())
S = [int(i) for i in input().split()]
q = int(input())
T = [int(i) for i in input().split()]


count = 0
for t in T:
    S.append(t)
    i = 0
    while t != S[i]:
        i += 1
    if i != (len(S) - 1):
        count += 1
    S.pop()
print(count)

Solution (Python):
input()
n1 = set(input().split())
input()
n2 = set(input().split())

print(len(n1&n2))

Solution (Python):
input()
n1 = set(input().split())
input()
n2 = set(input().split())

print(len(n1&n2))

Solution (Python):

n = int(input())
s = [int(i) for i in input().split()]
q = int(input())
t = [int(i) for i in input().split()]

ans = 0
for si in set(s):
    if si in t:
        ans += 1

print(ans)

Solution (Python):
input()
S = set(input().split())
input()
print(len([s for s in input().split() if s in S]))

Solution (Python):
input()
S = input().split()
input()
print(len([s for s in input().split() if s in S]))

Solution (Python):
input()
S = set(input().split())
input()
T = set(input().split())
print(len(S & T))

Solution (Python):
input()
S = set(input().split())
input()
T = set(input().split())
print(len(S & T))

Solution (Python):
n=int(input())
l1=list(map(int,input().split()))
m=int(input())
l2=list(map(int,input().split()))
c=0
for i in l2:
    if i in l1:
        c+=1
print(c)

Solution (Python):
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

cnt = 0
for t in T:
	if t in S:
		cnt += 1

print(cnt)

Solution (Python):
N = input()
S = set(map(int, input().split()))
Q = input()
T = set(map(int, input().split()))


intersection = S & T
print(len(intersection))

Solution (Python):
N = input()
S = set(map(int, input().split()))
Q = input()
T = set(map(int, input().split()))

ans = 0
for t in T:
  if t in S:
    ans += 1
print(ans)

Solution (Python):
def main():
    n = int(input())
    S = [int(i) for i in input().split()]
    q = int(input())
    T = [int(i) for i in input().split()]
    print(len(set(S) & set(T)))

main()

Solution (Python):
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

count = 0

for i in range(q):
    for j in range(n):
        if T[i] == S[j]:
            count += 1
            break

print(count)

Solution (Python):
n = int(input())
S = [int(x) for x in input().split()]
q = int(input())
T = [int(x) for x in input().split()]

count = 0
for target in T:
  if target in S:
    count += 1

print(count)

Solution (Python):
input()
s=set(raw_input().split())
input()
t=set(raw_input().split())
print len(s&t)

Solution (Python):

n = int(raw_input())
S = []
S = map(int, raw_input().split())

q = int(raw_input())
T = []
T = map(int, raw_input().split())

count = 0

for i in T:
	if i in S:
		count += 1

print count

Solution (Python):
n = input()
s = set(int(i) for i in input().split())
q = input()
t = set(int(i) for i in input().split())
print(len(t & s))

Solution (Python):


n = int(raw_input())
S = map(int, raw_input().strip(" ").split(" "))
q = int(raw_input())
T = map(int, raw_input().strip(" ").split(" "))

count = 0
for j in T:
	for n in S:
		if n == j:
			count += 1
			break

print count

Solution (Python):
n = int(raw_input())
S = map(int,raw_input().split())
q = int(raw_input())
T = map(int,raw_input().split())

C = 0
for i in T:
    for j in S:
        if i == j:
            C += 1
            break
print C

Solution (Python):
class Sequence:
    def __init__(self,num, seq):
        self.n = num
        self.sequence = seq

def LinearSearch(A, n, key):
    i=0
    A[n] = key
    while A[i] != key:
        i += 1
    if i==n:
        return "NOT_FOUND"
    return i

if __name__ == "__main__":

    n = int(raw_input())
    x =	map(int, raw_input().split())
    x.append(" ")
    A = Sequence(n, x)
    n =	int(raw_input())
    x =	map(int, raw_input().split())
    x.append(" ")
    B = Sequence(n, x)

    C_num = 0

    for i in range(B.n):
        res = LinearSearch(A.sequence, A.n, B.sequence[i])
        if res != "NOT_FOUND":
            C_num += 1

    print(C_num)

Solution (Python):



import sys



ary_s_len = int(sys.stdin.readline().rstrip())
ary_s = [int(x) for x in sys.stdin.readline().rstrip().split(' ')]
ary_t_len = int(sys.stdin.readline().rstrip())
ary_t = [int(x) for x in sys.stdin.readline().rstrip().split(' ')]
assert len(ary_s) == ary_s_len
assert len(ary_t) == ary_t_len

count = 0
for e in ary_t:
    for se in ary_s:
        if e == se:
            count += 1
            break

print count

Solution (Python):
n = int( raw_input( ) )
t = [ int( val ) for val in raw_input( ).rstrip( ).split( " " ) ]
q = int( raw_input( ) )
s = [ int( val ) for val in raw_input( ).split( " " ) ]

cnt = 0
for si in s:
	for ti in t:
		if si == ti:
			cnt += 1
			break

print( cnt )

Solution (Python):
n = int( input( ) )
t = [ int( val ) for val in input( ).rstrip( ).split( " " ) ]
q = int( input( ) )
s = [ int( val ) for val in input( ).split( " " ) ]

cnt = 0
for si in s:
	for ti in t:
		if si == ti:
			cnt += 1
			break

print( cnt )

Solution (Python):
n = int(raw_input())
S = map(int,raw_input().split())
q = int(raw_input())
T = map(int,raw_input().split())

c = 0
for t in T:
    for s in S:
        if(t == s):
            c+=1
            break
print c

Solution (Python):
n = int(input())
S = set(map(int, input().split()))
q = int(input())
T = set(map(int, input().split()))
print(len(S & T))

Solution (Python):
n = int( input( ) )
t = [ int( val ) for val in input( ).rstrip( ).split( " " ) ]
q = int( input( ) )
s = [ int( val ) for val in input( ).split( " " ) ]
 
cnt = 0
for si in s:
    for ti in t:
        if si == ti:
            cnt += 1
            break
 
print( cnt )

Solution (Python):
n = input()
s = set(input().split())
q = input()
t = set(input().split())

print(len(s & t))

Solution (Python):
n = int(input())
s = list(map(int, input().split()))
q = int(input())
t = list(map(int, input().split()))

ans = 0
for j in t:
    s.append(j)
    i = 0
    while s[i] != j:
        i += 1
    if i >= n:
        pass
    else:
        ans += 1
print(ans)

Solution (Python):
n = int(raw_input())
S = map(int, raw_input().split())
q = int(raw_input())
T = map(int, raw_input().split())
count = 0
for x in T:
    if x in S:
        count += 1
print count

Solution (Python):


def isFound(array, x):
    """ linear search """
    array.append(x)
    i = 0
    while array[i] != x:
        i += 1
    if i == len(array)-1:
        return False
    return True

n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
count = 0

for i in range(q):
    if isFound(S, T[i]):
        count += 1

print(count)

Solution (Python):


n = int(input())
S = set(map(int, input().split()))
q = int(input())
T = set(map(int, input().split()))

print(len(S & T))

Solution (Python):
n_1=input()
n_1_List=map(int,raw_input().split())
n_2=input()
n_2_List=map(int,raw_input().split())
n_1_List=set(n_1_List)
n_2_List=set(n_2_List)
print(len(n_1_List.intersection(n_2_List)))

Solution (Python):



def main():
    n = input()
    t = map(int, raw_input().split())
    q = input()
    s = map(int, raw_input().split())

    sum = 0
    for a in s:
        sum += 1 if a in t else 0

    print sum

main()

Solution (Python):
n = int(input())
S = input().split()

q = int(input())
T = input().split()

cnt = 0

for i in range(q):
    if T[i] in S:
        cnt += 1

print(cnt)

Solution (Python):
n = input()
S = set(input().split())
S.discard(' ')

q = input()
T = set(input().split())
T.discard(' ')


U = S.intersection(T)

print(len(U))

Solution (Python):
n = int(input())
S = input().split()
S.append(None)

q = int(input())
T = input().split()

cnt = 0

for i in range(q):
    sentry = T[i]
    S[n] = sentry
    j = 0
    while S[j] != sentry:
        j += 1
    if j != n:
        cnt += 1

print(cnt)

Solution (Python):
n = int(input())
S = set(map(int, input().split()))
q = int(input())
T = set(map(int, input().split()))
 
print(len(S & T))

Solution (Python):
n = int(raw_input())
S = map(int, raw_input().strip().split(' '))
q = int(raw_input())
T = map(int, raw_input().strip().split(' '))

def search(S,k):
    for s in S:
        if s == k:
            return True
    return False

c = 0
for t in T:
    if search(S,t): c += 1

print c

Solution (Python):



def linerSearch(S, key):
    i = 0
    S.append(key)
    while S[i] != key:
        i += 1
    if i == len(S)-1:
        S.pop()
        return False
    S.pop()
    return True

n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

count = 0

for i in range(q):
    if linerSearch(S, T[i]):
        count += 1

print (count)

Solution (Python):
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))


def linearSearch(A, n, key):
    i = 0
    A.append(key) 
    while A[i] != key:
        i += 1
    A.pop()
    return i != n

count = 0

for i in range(q):
    if linearSearch(S, n, T[i]):
        count += 1

print(count)

Solution (Python):
iterator = [["NS", "S"], ["NT", "T"]]
var = {}
for i, j in iterator:
    var[i] = int(input())
    var[j] = [int(k) for k in input().split()]
res = 0
for T in var["T"]:
    if T in var["S"]:
        res += 1
print(res)

Solution (Python):
def linear_search(li, value):
    for x in li:
        if x == value:
            return True
    return False

input() 
S = [int(x) for x in input().split()] 
input() 
T = [int(x) for x in input().split()]

ans = 0

for x in T:
    if linear_search(S, x):
        ans += 1

print(ans)

Solution (Python):
n = int(input())
a = input()
s=list(map(int,a.split()))

q = int(input())
a = input()
t=list(map(int,a.split()))

i = 0
for it in t:
    if it in s:
        i = i+1
print(i)

Solution (Python):
n = input()

S = map(int, raw_input().split())

q = input()

T = map(int, raw_input().split())

S.append(0)
cnt = 0
for i in range(q):
    j = 0
    S[n] = T[i]
    while S[j] != S[n]:
        j = j + 1
    if j != n:
        cnt = cnt + 1


print cnt

Solution (Python):
n = input()

S = [int(x) for x in raw_input().split()]

q = input()

T = [int(x) for x in raw_input().split()]

C = 0

for i in T:
 for j in S:
  if i==j:
   C += 1
   break

print C

Solution (Python):
n, s, q, t = input(), set(map(int, input().split())), input(), set(map(int, input().split()))
print(sum(i in s for i in t))

Solution (Python):
n = int(input())
S = [int(s) for s in str(input()).split()]
q = int(input())
T = [int(t) for t in str(input()).split()]


print(len([i for i in T if i in S]))

Solution (Python):
def linearSearch(S, key):
    i = 0
    S.append(key)
    while S[i] != key:
        i += 1
    if i == len(S)-1:
        return False
    return True

def main():
    n = int(raw_input())
    S = [int(_) for _ in raw_input().split()]
    q = int(raw_input())
    T = [int(_) for _ in raw_input().split()]
    Sum = 0
    for t in T:
        if linearSearch(S[:], t): Sum += 1
    print Sum
    return 0

main()

Solution (Python):
input()
s = set(n for n in input().split())
input()
t = set(n for n in input().split())
print(len(s & t))

Solution (Python):
n = input()
S = map(int, raw_input().split())
q = input()
T = map(int, raw_input().split())

count = 0

for i in range(q):
    Search = T[i]
    for j in range(n):
        if S[j] == Search:
            count = count + 1
            break

print count

Solution (Python):
def linearSearch(S, T):
    n = 0
    for t in T:
        for s in S:
            if s == t:
                n += 1
                break
    return n

if __name__ == "__main__":
    input()
    S = raw_input().split()
    input()
    T = raw_input().split()
    print linearSearch(S, T)

Solution (Python):
n = int(raw_input())
S = map(int, raw_input().split())
q = int(raw_input())
T = map(int, raw_input().split())

x = set(S) & set(T)
print len(x)

Solution (Python):
n = int(raw_input())
S = raw_input().split(" ")
q = int(raw_input())
T = raw_input().split(" ")

cnt = 0

for i in range(q):
    key = T[i]
    for j in range(n-1):
        if S[j] == key:
            cnt += 1
            break

print cnt

Solution (Python):
def linearSearch(A, n, key):
	i = 0
	A.append(key)
	while (A[i] != key):
		i += 1
	del A[n]

	return i != n


if __name__ == '__main__':
	
	n = int(input())
	L = list(map(int, input().split()))

	q = int(input())
	Key = list(map(int, input().split()))

	cnt = 0
	for i in range(q):
		if (linearSearch(L, n, Key[i])):
			cnt += 1

	print(cnt)

Solution (Python):


n = int(raw_input())
S = map(int, raw_input().split())
q = int(raw_input())
T = map(int, raw_input().split())
count = 0
for i in range(q):
    for j in range(n):
        if T[i] == S[j]:
            count += 1
            break
print count

Solution (Python):
n = int(input())
S = set(map(int, input().split()))
q = int(input())
T = set(map(int, input().split()))
print(len(S & T))

Solution (Python):
n = input()
s = input().split()
q = input()
t = input().split()

ans = 0
for c1 in t:
    for c2 in s:
        if c1 == c2:
            ans += 1
            break

print(ans)

Solution (Python):
def linear_search(l, key):
    _l = l + [key]

    i = 0
    while key != _l[i]:
        i += 1

    if i == len(_l) - 1:
        return -1

    return i


if __name__ == '__main__':
    n = input()
    s = input().split()
    q = input()
    t = input().split()

    ans = 0
    for c1 in t:
        if linear_search(s, c1) >= 0:
            ans += 1

    print(ans)

Solution (Python):
def linearSearch(S,t):
    L = S + [t]
    i = 0
    while L[i] != t: i += 1
    if i == len(L)-1: return 0
    else            : return 1

if __name__=='__main__':
    n=int(input()) 
    S=list(map(int,input().split()))
    q=int(input()) 
    T=list(map(int,input().split()))
    cnt = 0
    for t in T: cnt += linearSearch(S,t)
    print(cnt)

Solution (Python):
def linearSearch(S,t):
    L = S + [t]
    i = 0
    while L[i] != t: i += 1
    if i == len(L)-1: return 0
    else            : return 1

if __name__=='__main__':
    n=input() 
    S=input().split()
    q=input() 
    T=input().split()
    cnt = 0
    for t in T: cnt += linearSearch(S,t)
    print(cnt)

Solution (Python):
n = input()
S = raw_input().split()
q = input()
T = raw_input().split()

s = 0
for i in T:
    if i in S:
        s+=1
print s

Solution (Python):
n = int(input())
s = list(map(int, input().split()))

q = int(input())
t = list(map(int, input().split()))

count = 0
for i in range(len(t)):
    if t[i] in s:
        count += 1
print(count)

Solution (Python):
input()
s=set(raw_input().split())
input()
t=set(raw_input().split())
print len(s&t)

Solution (Python):



def linear_search(S, T):
    count = 0
    for i in xrange(len(T)):
        if T[i] in S:
            count += 1
    return count

if __name__ == '__main__':
    n = input()
    S = map(int, raw_input().split())
    q = input()
    T = map(int, raw_input().split())

    print linear_search(S, T)

Solution (Python):
n = input()
S = list(map(int, input().split()))
q = input()
T = list(map(int, input().split()))


def solve(s, t):
    cnt = 0
    for i in t:
        if i in s:
            cnt += 1
    return cnt


print(solve(S, T))

Solution (Python):

sample_input = list(range(3))
sample_input[0] = '''5
1 2 3 4 5
3
3 4 1'''
sample_input[1] = '''3
3 1 2
1
5'''
sample_input[2] = '''500
0 933 743 262 529 700 508 752 256 256 119 711 351 843 705 108 393 330 366 169 932 917 847 972 868 980 223 549 592 164 169 551 427 190 624 635 920 944 310 862 484 363 301 710 236 876 431 929 397 675 491 190 344 134 425 629 30 727 126 743 334 104 760 749 620 256 932 572 613 490 509 119 405 695 49 327 719 497 824 596 649 356 184 93 245 7 306 509 754 352 665 783 738 801 690 330 337 195 656 963 11 427 42 106 968 212 1 510 480 658 571 331 814 847 564 197 625 438 931 18 487 151 187 913 179 995 750 750 913 562 134 273 547 521 830 140 557 678 726 503 597 408 893 988 238 85 93 188 720 211 746 387 710 209 887 668 103 473 900 674 105 183 952 370 787 302 410 905 110 400 996 142 585 860 47 924 731 158 386 219 400 415 55 682 874 61 6 602 268 365 470 518 723 89 106 319 130 655 732 993 974 595 810 673 55 730 95 245 705 694 948 873 353 474 760 741 756 644 143 640 737 679 135 149 529 210 607 417 255 787 373 626 445 112 172 595 153 53 183 717 655 17 176 77 776 399 654 728 2 161 455 870 316 694 381 930 480 604 386 359 207 954 79 702 365 453 732 836 432 563 17 107 583 910 467 116 546 719 528 71 107 256 520 353 528 154 430 477 48 520 204 414 810 719 925 298 131 701 709 751 22 817 652 924 695 471 153 625 978 616 142 597 88 732 917 404 743 395 749 407 936 302 767 45 563 340 398 896 51 807 767 997 978 650 809 330 360 716 161 293 209 753 98 130 634 543 889 88 31 692 401 674 294 693 165 949 765 737 458 841 48 943 229 215 389 209 388 754 243 501 271 516 564 277 912 5 611 212 782 92 123 201 324 4 437 602 804 363 391 273 575 906 759 626 896 859 763 358 577 484 747 156 948 605 454 194 359 430 323 883 24 447 202 847 876 49 792 588 304 133 558 842 414 567 728 506 391 0 992 118 398 718 868 975 579 119 363 596 379 916 466 840 232 430 414 155 571 311 179 796 300 216 903 993 55 728 481 905 29 37 897 286 657 377 682 554 506 757 529 580 641 866 852 933 660 490 616 732 606 114 185 647 227 435 58 183 110 742 374 604 671 872 605 480 671 979 717 481 680 791
30
0 9 18 30 31 42 48 49 59 74 85 115 121 153 165 168 181 195 205 207 220 228 248 252 255 270 274 289 291 300'''
give_sample_input = None
if give_sample_input is not None:
    sample_input_list = sample_input[give_sample_input].split('\n')
    def input():
        return sample_input_list.pop(0)
        

num_of_S = int(input())
S = list(map(int, input().split(' ')))
num_of_T = int(input())
T = list(map(int, input().split(' ')))

count = 0
for s in S:
    for i in range(len(T)):
        if s == T[i]:
            count += 1
            T[i] = -1
            break

print(count)

Solution (Python):
def search(S,t):
    for s in S:
        if t == s:
            return True
    return False

n = int(raw_input())
S = map(int,raw_input().split(' '))
q = int(raw_input())
T = map(int,raw_input().split(' '))


ret = 0
for t in T:
    if search(S,t):
        ret += 1
print ret

Solution (Python):
n = int(input())
S = input().split()
q = int(input())
T = input().split()

count = 0
for i in T:
    if i in S:
        count += 1

print(count)

Solution (Python):

def main():
    n = int(input())
    S = [int(i) for i in input().split()]
    q = int(input())
    T = [int(i) for i in input().split()]
    
    count = 0
    for t in T:
        for s in S:
            if t == s:
                count += 1
                break

    print(count)

if __name__ == '__main__':
    main()

Solution (Python):
import sys

n = int(sys.stdin.readline())
s = [int(x) for x in sys.stdin.readline().split()]
q = int(sys.stdin.readline())
t = [int(x) for x in sys.stdin.readline().split()]
cnt = 0

for i in t:
    if i in s:
        cnt += 1

print(cnt)

Solution (Python):
import sys

n = sys.stdin.readline()
s = sys.stdin.readline().split()
q = sys.stdin.readline()
t = sys.stdin.readline().split()
cnt = 0

for i in t:
    if i in s:
        cnt += 1

print(cnt)

Solution (Python):
input()
s = input().split()
input()
t = input().split()

cnt = 0

for t1 in t:
    for s1 in s:
        if t1 == s1:
            cnt += 1
            break

print(cnt)

Solution (Python):
def find(target, list):
  for i in xrange(len(list)):
    if target == list[i]:
      return 1
  return 0


n = int(raw_input())
S = raw_input().split()
q = int(raw_input())
T = raw_input().split()
count = 0
for i in xrange(q):
  count += find(T[i], S)
print count

Solution (Python):
import sys
n = int(sys.stdin.readline()[:-1])
S = sorted(list(map(int, (sys.stdin.readline()[:-1]).split())))
q = int(sys.stdin.readline()[:-1])
T = sorted(list(map(int, (sys.stdin.readline()[:-1]).split())))

count = 0
for i in T:
    x = 0
    while x < len(S):
        if i == S[x]:
            count += 1
            S = S[x:]
            break
        x += 1

print(count)

Solution (Python):
n = int(input())
li1 = list(map(int,input().split()))
m = int(input())
li2 = list(map(int,input().split()))
cnt = 0

for i in li2:
	if i in li1:
		cnt +=1
print(cnt)

Solution (Python):
n = int(input())
s = [int(x) for x in input().split()]
q = int(input())
t = [int(x) for x in input().split()]
ans = 0

for x in t:
    c = s.count(x)
    if c != 0:
        ans += 1

print(ans)

Solution (Python):


n = input()
S = set(map(int,raw_input().split()))
q = input()
T = set(map(int,raw_input().split()))

print len(S & T)

Solution (Python):
n = input()
S = map(int,raw_input().split())
q = input()
T = map(int,raw_input().split())
ans = 0
for t in T:
    if t in S:
        ans+=1
print ans

Solution (Python):
n1 = int(raw_input())
nums1 = map(int, raw_input().split(" "))
n2 = int(raw_input())
nums2 = map(int, raw_input().split(" "))
nums1.append(-1)
count = 0

for key in nums2:
    nums1[len(nums1)-1] = key
    idx = 0

    while nums1[idx] != key:
        idx += 1

    if idx != len(nums1)-1:
        count += 1

print(count)

Solution (Python):

def LS(n,S,q,T):
    count=0
    if n>q:
        for i in range(q):
            if T[i] in S:
                count+=1
    else:
        for i in range(n):
            if S[i] in T:
                count+=1
    print(count)
  
if __name__=="__main__":
    n=int(input())
    S=input().split(" ")
    q=int(input())
    T=input().split(" ")
    LS(n,S,q,T)

Solution (Python):



class Solution:
    @staticmethod
    def linear_search():
        array_length_1 = int(input())
        array_1 = [int(x) for x in input().split()]
        array_length_2 = int(input())
        array_2 = [int(x) for x in input().split()]

        print(len(list(set(array_1).intersection(set(array_2)))))


if __name__ == '__main__':
    solution = Solution()
    solution.linear_search()

Solution (Python):



class Solution:
    @staticmethod
    def linear_search():
        array_length_1 = int(input())
        array_1 = [int(x) for x in input().split()]
        array_length_2 = int(input())
        array_2 = [int(x) for x in input().split()]

        print(len(set(array_1).intersection(set(array_2))))


if __name__ == '__main__':
    solution = Solution()
    solution.linear_search()

Solution (Python):

 
 
class Solution:
    @staticmethod
    def linear_search():
        array_length_1 = int(input())
        array_1 = [int(x) for x in input().split()]
        array_length_2 = int(input())
        array_2 = [int(x) for x in input().split()]
 
        print(len(set(array_1).intersection(set(array_2))))
 
 
if __name__ == '__main__':
    solution = Solution()
    solution.linear_search()

Solution (Python):



class Solution:
    @staticmethod
    def linear_search():
        array_length_1 = int(input())
        array_1 = [int(x) for x in input().split()]
        array_length_2 = int(input())
        array_2 = [int(x) for x in input().split()]

        
        count = 0
        for i in range(array_length_2):
            if array_2[i] in array_1:
                count += 1
        print(count)


if __name__ == '__main__':
    solution = Solution()
    solution.linear_search()

Solution (Python):



class Solution:
    @staticmethod
    def linear_search():
        array_length_1 = int(input())
        array_1 = [int(x) for x in input().split()]
        array_length_2 = int(input())
        array_2 = [int(x) for x in input().split()]

        
        count = 0
        for i in range(array_length_2):
            if array_2[i] in array_1:
                count += 1
        print(count)


if __name__ == '__main__':
    solution = Solution()
    solution.linear_search()

Solution (Python):



import sys


class Solution:
    def __init__(self):
        """
        init input array
        """
        self.__input = sys.stdin.readlines()

    @property
    def solution(self):
        length_1 = int(self.__input[0])
        array_1 = list(map(int, self.__input[1].split()))
        length_2 = int(self.__input[2])
        array_2 = list(map(int, self.__input[3].split()))

        assert length_1 == len(array_1) and length_2 == len(array_2)

        count = 0
        for each in array_2:
            if self.linear_search(key=each, array=array_1, array_length=length_1):
                count += 1

        return str(count)

    @staticmethod
    def linear_search(key, array, array_length):
        
        for i in range(array_length):
            if array[i] == key:
                return True
        return False


if __name__ == '__main__':
    case = Solution()
    print(case.solution)

Solution (Python):



def linearSearch(arr,key):
	arr.append(int(key))
	for idx,a in enumerate(arr):
		if a == key:
			if idx == (len(arr) - 1):
				return -1
			else :
				return 1
	
def main():
	Ns = int(raw_input())
	S  = map(int, raw_input().split())
	Nt = int(raw_input())
	T  = map(int, raw_input().split())

	sum_v = 0
	for key  in T:
		if linearSearch(S,key) > 0:
			sum_v += 1

	print sum_v



if __name__ == '__main__':
	main()

Solution (Python):



def linear_search(list_1, list_2):
    count = 0
    
    for a in list_1:
        i = 0
        list_2.append(a)
        while not a == list_2[i]:
            i += 1
        if not i == len(list_2) - 1:
            count += 1
            
        list_2 = list_2[:-1]
        
    return count

def main():
    n_listA = int(input())
    a = list(set([n for n in input().split()]))
    n_listB = int(input())
    b = list(set([n for n in input().split()]))
    print(linear_search(a,b))

if __name__ == "__main__":
    main()

Solution (Python):

if __name__ == '__main__':
    
    S_size = int(input())
    S = set([int(x) for x in input().split(' ')])
    T_size = int(input())
    T = set([int(x) for x in input().split(' ')])
    
    

    
    U = S.intersection(T)

    
    print('{0}'.format(len(U)))

Solution (Python):



''' ?????¢??¢?´¢ '''





def linear_search(S, T):
    count = 0
    for t in T:
        if t in S:
            count += 1
    return count

if __name__ == '__main__':
    NS = int(input())
    S = list(map(int, input().split()))
    NT = int(input())
    T = list(map(int, input().split()))

    print(linear_search(S, T))

Solution (Python):
n = int(input())
S = [x for x in input().split()]
q = int(input())
T = [x for x in input().split()]
answer = {x for x in S if x in T}
print(len(answer))

Solution (Python):


n = int(input())
s = list(map(int,input().split()))
q = int(input())
t = list(map(int,input().split()))
cnt = 0
for i in t:
    if i in s:
        cnt += 1
print(cnt)

Solution (Python):

input()
s = list(map(int,input().split()))
input()
t = list(map(int,input().split()))
cnt = 0
for i in t:
    if i in s:
        cnt += 1
print(cnt)

Solution (Python):


def linear(n,s,key):
    s[n:] = [key]
    i = 0
    while s[i] != key:
        i += 1
    return i != n
n = int(input())
s = list(map(int,input().split()))
input()
t = list(map(int,input().split()))
cnt = 0
for i in t:
    if linear(n,s,i):
        cnt += 1
print(cnt)

Solution (Python):

n=int(input())
s=map(int,input().split())
q=int(input())
t=map(int,input().split())

ans=len(set(s)&set(t))

print(ans)