n = gets.to_i
base = gets.chomp.split(" ").map(&:to_i)
m = gets.to_i
compare = gets.chomp.split(" ").map(&:to_i)
count = 0

(0..m-1).each do |i|
  left = 0
  right = n-1
  if base[n-1] >= compare[i] then
    while left < right
      mid = ((left+right)/2).floor
      if compare[i] == base[mid] then
        count += 1
        break
      elsif compare[i] < base[mid] then
        right = mid
      else
        left = mid
      end
    end
  end
end

puts count