int_s = gets.to_i
s_arr = gets.split(" ").map(&:to_i).uniq.sort!
int_t = gets.to_i
t_arr = gets.split(" ").map(&:to_i).uniq.sort!
sum = 0

s_arr.each do |val|
  left = 0
  right = t_arr.count

  while left < right
    mid = (left + right) / 2

    if t_arr[mid] == val
      sum += 1
      break
    elsif t_arr[mid] < val
      left = mid + 1
    else
      right = mid
    end
  end
end

puts sum