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

gets.to_i
s = gets.chomp.split ' '
gets.to_i
t = gets.chomp.split ' '
count = 0
t.each do |value|
  count += binary_search s, value
end
puts count
