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
  while left < right
    if base[n-1] < compare[i]
      break
    end
    mid = (left+right)/2
    if compare[i] == base[mid] then
      count += 1
      break
    elsif compare[i] < base[mid] then
      right = mid
    else
      left = mid + 1
    end
  end
end

puts count