#include using namespace std; using ll = long long; int main(){ clock_t finish = clock() + CLOCKS_PER_SEC / 1000 * 1920; ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector a(n); for(auto &&v:a)cin >> v; int pos = -1; int ans = 1 << 30; if(2 * n < ans){ ans = 2 * n; pos = 1; } if(a.back() + 2 < ans){ ans = a.back() + 2; pos = a.back() + 1; } int zi = 0; vector b(n); auto f = [&](int v){ int cnt = 1; while(zi < n && a[zi] < v) zi++; if(zi) b[zi - 1] = 0; for(int i = zi; i < n; i++){ b[i] = a[i] / v; if(i >= 1 && b[i] != b[i - 1])cnt++; } return (ll)(cnt) * (v + 1); }; zi = 0; for(int i = 1; i <= 320; i++){ ll v = f(i); if(v < ans){ ans = v; pos = i; } } zi = 0; for(int i = min(2 * n, 320); i >= 1; i--){ int d = 2 * n / i; ll v = f(d); if(v < ans){ ans = v; pos = d; } } cout << pos << '\n'; cout << ans << '\n'; }