#pragma GCC target("avx2") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #include using namespace std; typedef long long ll; vector r[10000000]; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; set xl; unordered_map sashi; unordered_map ars; int cnt = 0; int x = 0; vector a(n); vector b(n); int am = 0; ll setnum = 0; for (int i=0; i> x; b[i] = x; if (ars[0] == 0) setnum++; ars[0]++; am = max(am, x); if (x > 0){ if (xl.find(x) == xl.end()){ sashi[x] = cnt; r[cnt].push_back(i); cnt++; xl.insert(x); }else{ r[sashi[x]].push_back(i); } } } ll ans = (ll)am + 2; int ansx = am + 1; while (!xl.empty()){ auto xind = xl.end(); xind--; int x = *xind; xl.erase(xind); for (int j: r[sashi[x]]){ ars[a[j]]--; if (ars[a[j]] == 0){ setnum--; } a[j] = b[j] / x; if (ars[a[j]] == 0){ setnum++; } ars[a[j]]++; int targ = b[j] / (a[j] + 1); if (targ > 0){ if (xl.find(targ) == xl.end()){ sashi[targ] = cnt; r[cnt].push_back(j); cnt++; xl.insert(targ); }else{ r[sashi[targ]].push_back(j); } } } if (ans >= setnum * (x + 1)){ ans = setnum * (x + 1); ansx = x; } } cout << ansx << endl; cout << ans << endl; }