import std.algorithm; import std.stdio; import std.conv; import std.string; import std.typecons; void main(){ auto n = readln.strip.to!ulong; auto max = n - 1; auto r = (a){ import std.container; SList!ulong v; ulong i = 2; while(a != 1){ while(a % i == 0){ v.insertFront(i); a /= i; } i++; } return v; }(n); ulong[] v = [1, 1, 1]; foreach(a; r[]){ auto k = (){ ulong bf = ulong.max , t; foreach(uint i, y; v[]){ t = y < bf ? i : t; bf = y < bf ? y : bf; } return t; }(); v[k.to!uint] *= a; } auto min = v.map!("a-1").sum; writef("%d %d", min, max); }