n = gets.chomp.to_i
s = gets.chomp.split.map(&:to_i)
q = gets.chomp.to_i
t = gets.chomp.split.map(&:to_i)

def binary_search(key, n, list)
  left, right = 0, n

  while left < right
    mid = (left + right) / 2
    if list[mid] == key
      return true
    elsif list[mid] < key
      left = mid + 1
    else
      right = mid
    end
  end

  false
end

sum = 0
t.each do |num|
  sum += 1 if binary_search(num, n, s)
end
puts sum