#include #include #include using namespace std; int main() { cin.tie(nullptr), ios::sync_with_stdio(false); int N; cin >> N; vector A(N); for (auto &x : A) cin >> x; int best = 2 * N; int argbest = 1; for (int x = 2; x < N * 2; ++x) { int cnt = 0; for (int i = 0; i < N and cnt < best; i = lower_bound(begin(A) + i + 1, end(A), A[i] + x - A[i] % x) - begin(A)) { if (cnt + (N - i + x - 1) / x * (x + 1) >= best) { cnt = best; break; } cnt += x + 1; } if (best > cnt) best = cnt, argbest = x; } cout << argbest << '\n' << best << '\n'; }