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

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)

-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()] +n = sys.stdin.readline() +s = sys.stdin.readline().split() +q = sys.stdin.readline() +t = sys.stdin.readline().split()