def search(num, key)
  l = 0
  m = num/2
  r = num

  while num > 0 do
    if @array[m] > key
      r = m
      m = l + (r-l)/2
    elsif @array[m] < key
      l = m + 1
      m = l + (r-l)/2
    elsif @array[m] == key
      return 1
    end
    break if l > m
    num /= 2
  end
  return 0
end

count = 0
n = gets.to_i
@array = gets.split(" ").map{|x| x.to_i}
@array.unshift(nil)
gets
search = gets.split(" ").map{|x| x.to_i}
search.each do |x|
  count += search(n, x)
end
puts count

