


def linear_search(array, value)
  length = array.length
  i = 0
array.push(value)
  while true
    
    if array[i] == value
      if i == length
        break
      else
        return true
      end
    else
      i += 1
    end
  end
  array.delete(-1)
end

  # for i in 0..(length-1)
  #   if array[i] != value
  #     count += 1
  #   elsif count == value
  #     break
  #   else
  #   return true
  #   end
#   end
# end

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

sum_count = -1
  for i in 0..(n-1)
    if linear_search(s, t[i]) == true
      sum_count += 1
    end
  end

puts sum_count