from sys import stdin

n = int(input())
S = stdin.readline().split()
q = int(input())
T = stdin.readline().split()

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

print(cnt) from sys import stdin n = int(input()) n int(input()) int input() input S = stdin.readline().split() S stdin.readline().split() stdin.readline().split stdin.readline() stdin.readline stdin readline split q = int(input()) q int(input()) int input() input T = stdin.readline().split() T stdin.readline().split() stdin.readline().split stdin.readline() stdin.readline stdin readline split cnt = 0 cnt 0 for x in T:
    if x in S:
        cnt += 1 x T if x in S:
        cnt += 1 x in S x S cnt += 1 cnt 1 print(cnt) print cnt S = stdin.readline().split() stdin.readline().split() S T = stdin.readline().split() stdin.readline().split() T n = int(input()) int(input()) n cnt = 0 0 cnt q = int(input()) int(input()) q cnt += 1 1 cnt
from sys import stdin

n = int(input())
S = stdin.readline().split()
q = int(input())
T = stdin.readline().split()

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

print(cnt)
