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

