class Integer def divisor_list require 'prime' return [] if self <= 0 return [1] if self == 1 prime_division.map.with_index { |(base, k), i| s = i.zero? ? 0 : 1 (s..k).map { |n| base ** n } }.inject { |res, e| res + res.flat_map { |t| e.map { |v| t * v } } }.sort end end N = gets.to_i min_t = Float::INFINITY max_t = N - 1 divisor_list = N.divisor_list divisor_list.each do |a| divisor_list.each do |b| c, m = N.divmod(a * b) next if m != 0 t = a + b + c - 3 min_t = t if min_t > t end end puts [min_t, max_t].join(' ')