n = gets.to_i
s = gets.split.map(&:to_i)
q = gets.to_i
t = gets.split.map(&:to_i)
count = 0
for i in 0..(n-1)
  for j in 0..(q-1)
    if s[i] == t[j]
      count += 1
      break
    end
  end
end
puts count