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 sys n = sys.stdin.readline() n sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline s = sys.stdin.readline().split() s sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split q = sys.stdin.readline() q sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline t = sys.stdin.readline().split() t sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split cnt = 0 cnt 0 for i in t:
    if i in s:
        cnt += 1 i t if i in s:
        cnt += 1 i in s i s cnt += 1 cnt 1 print(cnt) print cnt n = sys.stdin.readline() sys.stdin.readline() n s = sys.stdin.readline().split() sys.stdin.readline().split() s cnt = 0 0 cnt q = sys.stdin.readline() sys.stdin.readline() q t = sys.stdin.readline().split() sys.stdin.readline().split() t cnt += 1 1 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)