#include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int d = sqrt(2 * n) + 1; pair ans = {2 * n, 1}; for (int i = 2; i <= d; i++) { int cnt = 1; for (int j = 1; j < n; j++) { if (a[j] / i > a[j - 1] / i) { cnt++; } } ans = min(ans, {cnt * (i + 1), i}); } vector pt(2 * d); for (int i = d + 1; i < 2 * n; i++) { for (int j = 1; j < 2 * d; j++) { while (pt[j] < n && a[pt[j]] / i <= a[pt[j] - 1] / i) { pt[j]++; } if (pt[j] == n) { ans = min(ans, {j * (i + 1), i}); break; } } } cout << ans.second << '\n' << ans.first; }