def binary_search(array, value)

  left = 0
  right = array[-1]
  mid = 0

  while left <= right do
    mid = (left + right) / 2
    if array[mid] == value
      return true
    elsif array[mid] < value
      left = mid + 1
    else
      right = mid - 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