n = gets.to_i
s = gets.split.map(&:to_i)
q = gets.to_i
t = gets.split.map(&:to_i)
t.sort!
cnt = 0
idx = 0
for i in 0...q
  while t[i] > s[idx]
    idx += 1
  end
  if t[i] == s[idx]
    cnt += 1
  end
end
puts cnt