#include using namespace std; int main() { int n; cin >> n; vector a(n); for (auto&& t : a) cin >> t; a.push_back(2e9); int Min = 1e9, Minx = -1; for (int x = 1; x <= n * 2; x++) { int i = 0, k = 0; while (i < n) { i = lower_bound(begin(a) + i + 1, end(a), (a[i] / x + 1) * x) - begin(a); k++; } if (Min > k * (x + 1)) Min = k * (x + 1), Minx = x; } cout << Minx << "\n"; cout << Min << "\n"; }