import std.algorithm; import std.stdio; import std.conv; import std.string; import std.typecons; import std.math; void main(){ auto n = readln.strip.to!ulong; auto max = n - 1; auto a = (x){ foreach_reverse(p; 2..x.to!real.cbrt.ceil.to!ulong){ if(x % p == 0){ return p; } } return 1; }(n); n /= a; auto b = (x){ foreach_reverse(p; 2..x.to!real.sqrt.ceil.to!ulong){ if(x % p == 0){ return p; } } return 1; }(n); auto c = n / b; auto min = (a - 1) + (b - 1) + (c - 1); writef("%d %d", min, max); }