def binary_search ss, t
  while ss
    len = ss.length
    break if len == 0
    i = len / 2
    if ss[i] == t
      return true
    elsif ss[i] < t
      ss = ss.slice((i+1)..(len-1))
    else
      if len == 1
        ss = []
      else
        ss = ss.slice(0..(i-1))
      end
    end
  end
  false
end

n = gets.chomp.to_i
ss = gets.chomp.split(' ').map(&:to_i)
q = gets.chomp.to_i
ts = gets.chomp.split(' ').map(&:to_i)

c = 0
ts.each do |t|
  c += 1 if binary_search ss, t
end
puts c
