n = gets.to_i
S = gets.split.map(&:to_i).sort!
q = gets.to_i
T = gets.split.map(&:to_i).sort!

def binary_search(s, t)
  left, right = 0, s.size
  while left < right
    mid = (left + right) / 2
    if s[mid] == t
      return 1
    elsif s[mid] > t
      right = mid
    else
      left = mid + 1
    end
  end
  return 0
end

ans = 0
T.each{ | t | ans += binary_search(S, t) }
puts ans
