n=gets.chomp.to_i
s=gets.chomp.split(" ").map{|i|i.to_i}
q=gets.chomp.to_i
t=gets.chomp.split(" ").map{|i|i.to_i}
cnt=0

def binary_search(key,array)
  n=array.size
  left = 0
  right = n-1
  while left <= right
    center = (left + right)/2
    val = array[center]
    return 1 if key == val
    if key > val
      left = center + 1
    else
      right = center - 1
    end
  end
  return 0
end

t.each do |key|
  cnt += binary_search(key, s)
end
puts cnt
