def bsearch(q, items)
  lb, ub = 0, items.length
  while ub - lb > 1
    mid = (ub+lb)/2
    if items[mid] <= q
      lb = mid
    else
      ub = mid
    end
  end
  items[lb] === q
end

def solve(qs, items)
  items.sort!
  qs.select {|q| bsearch(q, items)}.count
end

gets
items = gets.split(" ").map(&:to_i)
gets
qs = gets.split(" ").map(&:to_i)
puts solve(qs, items)

