n=int(input())
a=input().split()

m=int(input())
b=input().split()

a=[int(i) for i in a]
b=[int(i) for i in b]

a.sort()
b.sort()
cnt=0

for j in range(m):
  if b[j] in a:
    cnt+=1
print(cnt)

 n=int(input()) n int(input()) int input() input a=input().split() a input().split() ().split () input split m=int(input()) m int(input()) int input() input b=input().split() b input().split() ().split () input split int(i) for i in a for i in a i a for i in a int(i) int i a=[int(i) for i in a] a [int(i) for i in a] int(i) for i in b for i in b i b for i in b int(i) int i b=[int(i) for i in b] b [int(i) for i in b] a.sort() a.sort a sort b.sort() b.sort b sort cnt=0 cnt 0 for j in range(m):
  if b[j] in a:
    cnt+=1 j range(m) range m if b[j] in a:
    cnt+=1 b[j] in a b[j] b j a cnt+=1 cnt 1 print(cnt) print cnt cnt=0 0 cnt a=[int(i) for i in a] [int(i) for i in a] a m=int(input()) int(input()) m b=[int(i) for i in b] [int(i) for i in b] b n=int(input()) int(input()) n a=input().split() input().split() a cnt+=1 1 cnt b=input().split() input().split() b
n=int(input())
a=input().split()

m=int(input())
b=input().split()

a=[int(i) for i in a]
b=[int(i) for i in b]

a.sort()
b.sort()
cnt=0

for j in range(m):
  if b[j] in a:
    cnt+=1
print(cnt)


