def binarySearch (ary, n, key)

  left  = 0
  right = n
  mid   = n / 2

  while left < right

    if ary[mid] == key then return 1

    elsif key < ary[mid] then right = mid

    else left = mid + 1 end

    mid = (left + right) / 2

  end

  return 0
end

num_of_ary = gets.to_i
ary        = gets.split.map &:to_i
num_of_key = gets
keys       = gets.split.map &:to_i

answer = 0

keys.each { |key| answer += binarySearch(ary, num_of_ary, key) }

puts answer

