class SearchII
  def solve
    n = gets.chomp.to_i
    s = gets.scan(/\d+/).map(&:to_i)
    q = gets.chomp.to_i
    t = gets.scan(/\d+/).map(&:to_i)

    t.sort!

    i = 0
    j = 0
    cnt = 0

    while ((i < s.length) && (j < t.length))
      if (s[i] == t[j])
        cnt += 1
        i += 1
        j += 1
      elsif (s[i] > t[j])
        j += 1
      else
        i += 1
      end
    end
    return cnt.to_s
  end
end

if $0 == __FILE__
  puts SearchII.new.solve
end