/* -*- coding: utf-8 -*- * * 2221.cc: No.2221 Set X - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 100000; /* typedef */ using ll = long long; /* global variables */ int as[MAX_N]; /* subroutines */ ll f(int n, int x, ll minf) { int c = 0, pa = -1; for (int i = 0; i < n; i++) { int ax = as[i] / x; if (pa != ax) { c++, pa = ax; if ((ll)(x + 1) * c > minf) return minf + 1; } } return (ll)(x + 1) * c; } /* main */ int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", as + i); int maxx = n * 2, minx = 1; ll minf = n * 2; for (int x = 1; x <= maxx; x++) { ll fx = f(n, x, minf); if (minf > fx) minf = fx, minx = x; //printf(" %lld", fx); } //putchar('\n'); printf("%d\n%lld\n", minx, minf); return 0; }