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 ≤ 109

0 ≤ an element in T ≤ 109

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

Template in C
-->



Sample input:
5
1 2 3 4 5
3
3 4 1


Sample output:
3

Submission status: Wrong Answer

Solution code:
n1 = int(input())
a1 = list(map(int, input().split()))
n2 = int(input())
a2 = list(map(int, input().split()))

cnt = 0

for i in range(n1) :
    for j in range(n2) :
        if a1[i] == a2[j] :
            cnt += 1
            
print(cnt)

Submission status: Wrong Answer

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

print(len(n1-n2))

Submission status: Wrong Answer

Solution code:

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 s:
    if si in t:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
a=input()
a = list(map(int, input().split()))
b=input()
b = list(map(int, input().split()))
c=0
tmp=[]
for i in a:
    for j in b:
        if i==j:
            a.remove(i)
            c+=1
print(c)

Submission status: Wrong Answer

Solution code:
a=input()
a = list(map(int, input().split()))
b=input()
b = list(map(int, input().split()))
c=0
tmp=[]
for i in a:
    for j in b:
        if i==j:
            a.remove(i)
            c+=1
print(c)

Submission status: Wrong Answer

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

main()

Submission status: Wrong Answer

Solution code:

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 S:
	if i in T:
		count += 1

print count

Submission status: Wrong Answer

Solution code:
# import sys

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 n in S:
	for j in T:
		if n == j:
			count += 1

print count

Submission status: Wrong Answer

Solution code:
# import sys

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 n in S:
	for j in T:
		if n == j:
			count += 1
                        break

print count

Submission status: Wrong Answer

Solution code:
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
            continue
print C

Submission status: Wrong Answer

Solution code:
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
            #continue
print C

Submission status: Wrong Answer

Solution code:
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_A
# Linear Search
# Result:
import sys


### main
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

print count

Submission status: Wrong Answer

Solution code:

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

print c

Submission status: Wrong Answer

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

ans = 0
for j in s:
    for k in t:
        if k == j:
            ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
raw_input()
s = map(int,raw_input().split())
raw_input()
n = map(int,raw_input().split())

count = 0
for i in s:
	for j in n:
		if i == j:
			count += 1
			
print count

Submission status: Wrong Answer

Solution code:
# encoding: utf-8


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

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

    print sum

main()

Submission status: Wrong Answer

Solution code:
n = int(input())
S = input()

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

cnt = 0

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

print(cnt)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


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

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 i in range(q):
    if linerSearch(S, T[i]):
        count += 1

print (count)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


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 (S)

print (count)

Submission status: Wrong Answer

Solution code:
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
    return i != n

count = 0

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

print(count)

Submission status: Wrong Answer

Solution code:
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]):
        print(S)
        count += 1

print(count)

Submission status: Wrong Answer

Solution code:
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"]:
    res += var["S"].count(T)
print(res)

Submission status: Wrong Answer

Solution code:
def linear_search(li, value):
    num = 0
    for x in li:
        if x == value:
            num += 1
    return num

input() # n
S = [int(x) for x in input().split()]    # s
input() # q
T = [int(x) for x in input().split()]

ans = 0

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

print(ans)

Submission status: Wrong Answer

Solution code:
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 t:
        i = i+1
print(i)

Submission status: Wrong Answer

Solution code:
n = input()

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

q = input()

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

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

Submission status: Wrong Answer

Solution code:
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 S:
 for j in T:
  if i==j:
   C += 1

print C

Submission status: Wrong Answer

Solution code:
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 S:
 for j in T:
  if i==j:
   C += 1
   break

print C

Submission status: Wrong Answer

Solution code:
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 range(n):
 for j in range(q):
  if S[i]==T[j]:
   C += 1

print C

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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(n, S, q, T)

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

Submission status: Wrong Answer

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

C = 0

for ti in T:
    C += S.count(ti)

print(C)

Submission status: Wrong Answer

Solution code:
def linearSearch(S, key):
    i = 0
    S.append(key)
    while S[i] != key:
        i += 1
    if i == len(S):
        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()

Submission status: Wrong Answer

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

count = 0

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

print count

Submission status: Wrong Answer

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

count = 0

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

print count

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n = int(raw_input('>> '))
S = raw_input('>> ').split(' ')
q = int(raw_input('>> '))
T = raw_input('>> ').split(' ')

count = 0
for t in T:
    for s in S:
        if t==s:
            count+=1

print count

Submission status: Wrong Answer

Solution code:
n = int(raw_input('>> '))
S = raw_input('>> ').split(' ')
q = int(raw_input('>> '))
T = raw_input('>> ').split(' ')

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

print count

Submission status: Wrong Answer

Solution code:
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=int,input().split()
    cnt = 0
    for t in T: cnt += linearSearch(S,t)
    print(cnt)

Submission status: Wrong Answer

Solution code:
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_A&lang=jp
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] = ''''''
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)
        
# main
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:
    if s in T:
        count += 1
        continue

print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
S = [int(i) for i in input().split()]
q = int(input())
T = set([int(i) for i in input().split()])

count = 0
for i in T:
    while True:
        if i in S:
            count += 1
            S.remove(i)
        else:
            break

print(count)

Submission status: Wrong Answer

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

cnt = 0

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

print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(raw_input())
S = raw_input().split()
q = int(raw_input())
T = raw_input().split()
count = 0
for i in xrange(q):
  for j in xrange(n):
    if S[j] == T[i]:
      count += 1
print count

Submission status: Wrong Answer

Solution code:
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 < (n-1):
        if i == S[x]:
            count += 1
            S[x+1:]
            break
        x += 1

print(count)

Submission status: Wrong Answer

Solution code:
#http://judge.u-aizu.ac.jp/onlinejudge/commentary.jsp?id=ALDS1_4_A
#?????¢??¢?´¢
#???????????§?¨????????????????????????¨?????§??????????????\????????????????????????????????????
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 = [n for n in input().split()]
    n_listB = int(input())
    b = [n for n in input().split()]
    print(linear_search(a,b))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter

if __name__ == '__main__':
    # ??????????????\???
    S_size = int(input())
    S = [int(x) for x in input().split(' ')]
    T_size = int(input())
    T = [int(x) for x in input().split(' ')]
    # S = [1, 2, 3, 4, 5, 1]
    # T = set([3, 4, 1])

    # ????????????
    c = Counter(S)
    match_count = 0
    for t in T:
        if t in c:
            match_count += c[t]

    # ???????????????
    print('{0}'.format(match_count))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# input
def linearSearch(n,S,key):
    S.append(key)
    i = 0
    while S[i] != key:
        i += 1
    if i == n :
        return False
    return True
n = int(input())
S = [int(x) for x in input().split()]
q = int(input())
T = [int(x) for x in input().split()]
s = 0
for i in range(q):
    if linearSearch(n,S,T[i]):
        s += 1
print(s)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
count = 0
for i in T:
    if linear_search(S, n, i):
        count += 1


print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = tuple(map(int,input().split()))
input()
t = set(map(int,input().split()))
c = 0
for i in range(n):
    if s[i] in t:
        c += 1
print(c)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    s_length = int(raw_input())
    s = [int(x) for x in raw_input().strip().split(' ')]
    t_length = int(raw_input())
    t = [int(x) for x in raw_input().strip().split(' ')]

    print len(s and t)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    s_length = raw_input()
    s = raw_input().strip().split(' ')
    t_length = raw_input()
    t = raw_input().strip().split(' ')

    print len(s and t)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
def linear_search(value, target_list):
    for key in target_list:
        print value, key
        if value == key:
            return True
        else:
            return False



def main():
    s_length = raw_input()
    s = raw_input().strip().split(' ')
    t_length = raw_input()
    t = raw_input().strip().split(' ')
    
    counter = 0
    for t_value in t:
        counter += int(linear_search(t_value, s))

    print counter

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
S = [int(i) for i in input().split()]
q = int(input())
T = [int(i) for i in input().split()]
C = 0
for i in T:
    for j in S:
        if j == i:
            C += 1
print(C)

Submission status: Wrong Answer

Solution code:
n = int(input())
S = [int(i) for i in input().split()]
q = int(input())
T = [int(i) for i in input().split()]
C = 0
for i in S:
    for j in T:
        if j == i:
            C += 1
print(C)

Submission status: Wrong Answer

Solution code:
n = list(input())
sList = list(input().split())

q = list(input())
tList = list(input().split())

tCount = 0

for tmp_t in tList:
    tCount += sList.count(tmp_t)

print(tCount)

Submission status: Wrong Answer

Solution code:
n = list(input())
sList = list(map(int,input().split()))

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

tCount = 0

for tmp_t in tList:
    tCount += sList.count(tmp_t)

print(tCount)

Submission status: Wrong Answer

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

print(len(s) - len(s & t))

Submission status: Wrong Answer

Solution code:
import math

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

cnt = 0
left = 0
right = n
for i in t:
    left = 0
    right = n
    while left < right:
        mid = math.floor((left + right) / 2)
        if s[mid] == i:
            cnt += 1
            left = right +1
        elif s[mid] > i:
            right = mid
        else:
            left = mid + 1
print(cnt)

Submission status: Wrong Answer

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


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

    for key in T:
        if linearSearch(S,key) is not False:
            cnt += 1

    print(cnt)

Submission status: Wrong Answer

Solution code:
n=int(input())
S=list(map(int,input().split()))

q=int(input())
T=list(map(int,input().split()))
c=0
for i in S:
    for j in T:
        if i==j:
            c+=1
print(c)

Submission status: Wrong Answer

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


res = 0

for num in S:
    if num in T:
        res += 1

print(res)

Submission status: Wrong Answer

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

for i in range(n):
    for j in range(q):
        if s[i] == t[j]:
            cnt += 1

print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
cnt = 0
for i in T:
 for j in S:
  if i == j:
   cnt += 1

print(str(cnt))

Submission status: Wrong Answer

Solution code:
n = int(input())
S = tuple(map(int, input().split()))
q = int(input())
T = tuple(map(int, input().split()))

cnt = 0
for n in T:
    cnt += S.count(n)

print(cnt)

Submission status: Wrong Answer

Solution code:
def BinarySearch(A, key):
    left = 0
    right = len(A)-1
    while left < right:
        mid = (left + right) // 2
        if A[mid] == key:
            return mid
        elif key < A[mid]:
            right = mid
        else:
            left = mid+1
    return -1
    
n = int(input())
S = list(map(int, input().split(" ")))
q = int(input())
T = list(map(int, input().split(" ")))

C = 0
for t in T:
    if BinarySearch(S, t) != -1:
        C += 1
print(C)

Submission status: Wrong Answer

Solution code:
n1 = int(input())
s = (input()).split()
n2 = int(input())
t = (input()).split()
m = []

for i in range(0, n1):
      key = s[i]
      for j in range(0, n2):
            if t[j] == s[i]:
                  m.append(t[j])
            break

print(len(m))

Submission status: Wrong Answer

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

s.sort()
t.sort()

cnt = 0
i = 0

for a in t:
	for b in s[i:]:
		if b > a:
			break
		elif a == b:
			cnt += 1
		i += 1
		
print(cnt)

Submission status: Wrong Answer

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

s.sort()
t.sort()

cnt = 0

for a in t:
	for b in s:
		if b > a:
			break
		elif a == b:
			cnt += 1
		
print(cnt)

Submission status: Wrong Answer

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

s.sort()
t.sort()

cnt = 0

for a in t:
	for b in s:
		if b < a:
			break
		elif a == b:
			cnt += 1
		
print(cnt)

Submission status: Wrong Answer

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

s.sort()
t.sort()

cnt = 0

for a in t:
	cnt += s.count(a)
		
print(cnt)

Submission status: Wrong Answer

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

cnt = 0

for a in s:
	for b in t:
		if a == b:
			cnt += 1
			break

print(cnt)

Submission status: Wrong Answer

Solution code:
def linearSearch(t):
    i=0
    S.append(t)
    while S[i]!=t:
        i+=1
    if i==n:
        return 0
    return 1

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

C=0

for t in T:
    C+=linearSearch(t)
    
print(C)

Submission status: Wrong Answer

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

def ls(A, k):
    for a in A:
        if k == a:
            return True
    return False

print(sum([ls(S, t) for t in T]))

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

counter = Counter(S)
sum = 0

for i in T:
    sum += counter[i]

print(sum)

Submission status: Wrong Answer

Solution code:
import sys

n = int(sys.stdin.readline().strip())
S = map(int, sys.stdin.readline().strip().split(" "))

n = int(sys.stdin.readline().strip())
T = map(int, sys.stdin.readline().strip().split(" "))

res = []

for t in T:
    res.append(S.count(t))
print sum(res)

Submission status: Wrong Answer

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

cnt = 0
for i in S:
    for j in T:
        if i == j:
            cnt += 1
            break
print(cnt)

Submission status: Wrong Answer

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

cnt = 0
for i in S:
    for j in T:
        if i == j:
            cnt += 1
print(cnt)

Submission status: Wrong Answer

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

cnt = 0
for i in S:
    for j in T:
        if i == j:
            cnt += 1
            break
print(cnt)

Submission status: Wrong Answer

Solution code:
n = input()
s = list(map(int, input().split()))
nn = input()
t = list(map(int, input().split()))

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

Submission status: Wrong Answer

Solution code:
def linearSearch(S, T):
    cnt = 0
    for e in T:
        if e in S:
            cnt += 1
    return cnt if cnt else "NOT_FOUND"


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

    print(linearSearch(s, t))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

count = 0
for key in T:
    U = list(S) + [key]
    i = 0
    while U[i] != key:
        i = i+1
    if i != n:
        count = count + 1
print(count)

Submission status: Wrong Answer

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

count = 0
for key in T:
    U = list(S) + [key]
    i = 0
    while U[i] != key:
        i = i+1
    if i != n+1:
        count = count + 1
print(count)

Submission status: Wrong Answer

Solution code:
n = input()
S = list(input().split())
q = int(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)

Submission status: Wrong Answer

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

Sum = 0
for i in S:
  if i in T:
    Sum += 1
print(Sum)

Submission status: Wrong Answer

Solution code:
def search(S, n, t):
    i=0
    S.append(t)
    while (S[i] != t):
        i+=1
    return i!=n

sum=0

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

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

for i in range(0,q):
    if search(S,n,T[i]):
        sum+=1

print(sum)

Submission status: Wrong Answer

Solution code:
input()
l = [int(i) for i in input().split()]
input()
c = 0
for i in input().split():
    for j in l:
        if i == l:
            c += 1
print(c)

Submission status: Wrong Answer

Solution code:
input()
l = [int(i) for i in input().split()]
input()
c = 0
for i in input().split():
    for j in l:
        if int(i) == l:
            c += 1
print(c)

Submission status: Wrong Answer

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

def equal_element(S,T):
	m=0
	for i in range(len(S)):
		for j in range(len(T)):
			if S[i]==T[j]:
				m+=1
				break
	return(m)
	
print(equal_element(S,T))

Submission status: Wrong Answer

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

def equal_element(S,T):
	m=0
	for i in range(len(T)):
		for j in range(len(S)):
			if S[j]==T[i]:
				m+=1
	return(m)
	
print(equal_element(S,T))

Submission status: Wrong Answer

Solution code:
# 線形探索
def linearSearch(S, N, key):
    i = 0
    S.append(key)
    while S[i] != key:
        i += 1
    if i != N:
        return True
    
N = int(input())
S = list(map(int,input().split()))
q = int(input())
T = list(map(int,input().split()))  

sum = 0 

for j in range(q):
    if linearSearch(S,N,T[j]):
        sum += 1
    
print(sum)

Submission status: Wrong Answer

Solution code:
def linearSearch(A, key):
    i = 0
    A.append(key)
    while A[i] != key:
        i += 1
    if i == n:
        return 'Not_found'
    return i

if __name__ == '__main__':
    c = 0
    n = int(input())
    hoge1 = [int(x) for x in input().split()]
    q = int(input())
    for key in (int(x) for x in input().split()):
        if linearSearch(hoge1, key) == 'Not_found':
            continue
        else:
            c += 1
    print (c)

Submission status: Wrong Answer

Solution code:
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 s[j] == t[i]:
            count += 1
print(count)

Submission status: Wrong Answer

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

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

count = 0
j=0

for i in range(q):
    s.append(t[i])
    while t[i] != s[j]:
        j += 1
    if j != n:
        count += 1
    del s[n]
print(count)

Submission status: Wrong Answer

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

Sset = set(S)
Tset = set(T)

print(len(Sset and Tset))

Submission status: Wrong Answer

Solution code:
ns = int(input())
s = list(map(int, input().split()))

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

count = 0

for i in t:
    # 配列に番兵を追加
    s += [i]
    j = 0
    while s[j] != i:
        j += 1
    if j == ns:
        continue
    count += 1

print(count)

Submission status: Wrong Answer

Solution code:
ns = int(input())
s = list(map(int, input().split()))

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

count = 0

for i in t:
    # 配列に番兵を追加
    s += [i]
    print(s)
    j = 0
    while s[j] != i:
        j += 1
    s.pop()
    if j == ns:
        continue
    count += 1

print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(map(int,input().split()))
m = int(input())
t = list(map(int,input().split()))
c = 0
for i in range(m):
    c += s.count(t[i])
print(c)

Submission status: Wrong Answer

Solution code:
S=[]
T=[]

S_num=int(input())
S=input().split()

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

cnt=0
for i in range(S_num):
	for j in range(T_num):
		if(S[i]==T[j]):
			cnt+=1

print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input().split()
q = int(input())
t = input().split()
c = 0

for i in s:
    for j in t:
        if i == j:
            c += 1
print(c)

Submission status: Wrong Answer

Solution code:
n1=int(input())
l1=list(input().split())

n2=int(input())
l2=list(input().split())


cnt=0
for x in l1:
    if x in l2:
        cnt+=1

print(cnt)

Submission status: Wrong Answer

Solution code:
n1=int(input())
l1=list(input().split())

n2=int(input())
l2=list(input().split())


cnt=0
for x in l2:
    if x in l1:
        cnt=cnt+1
        print("同じ:",x)

print(cnt)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input().split()
q=int(input())
t=input().split()
cnt=0

for i in range(n):
    for j in range(q):
        if s[i]==t[j]:
            cnt+=1
            
print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
S = list(map(int, input().split()))

n = int(input())
T = list(map(int, input().split()))
cnt = 0

for i in T:
    for j in S:
        if j == i:
            cnt += 1

print(cnt)

Submission status: Wrong Answer

Solution code:
c=0
n=int(input())
s=input().split()
q=int(input())
t=input().split()
for i in t:
	for j in s:
		if int(i)==int(j):
			c +=1
print(c)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(map(int,input().split()))
q = int(input())
r = list(map(int,input().split()))
cou = 0

for i in range(n):
    for j in range(q):
        if(s[i] == r[j]):
            cou += 1
            break
print(cou)