def binary_search(array, target)
  num_of_elements = array.length
  left = 0
  right = num_of_elements-1
  while left <= right
    center = (left + right)/2
    if array[center] == target
      return true
    elsif array[center] < target
      left = center+1
    else
      right = center-1
    end
  end
end

n = gets.chomp.to_i
s = gets.chomp.split.map(&:to_i)
q = gets.chomp.to_i
t = gets.chomp.split.map(&:to_i)

sum_count = 0
for i in 0..(q-1)
  if binary_search(s, t[i]) == true
    sum_count += 1
  end
end

puts sum_count