import sys def main(): input = sys.stdin.read().split() N = int(input[0]) A = list(map(int, input[1:N+1])) max_A = A[-1] def compute_f(X): if X == 0: return float('inf') prev = A[0] // X count = 1 for a in A[1:]: current = a // X if current != prev: count += 1 prev = current return (X + 1) * count # Binary search in [1, max_A] low = 1 high = max_A while low < high: mid = (low + high) // 2 if compute_f(mid) < compute_f(mid + 1): high = mid else: low = mid + 1 X_candidate = low # Generate candidates around X_candidate, max_A, and max_A + 1 candidates = set() start = max(1, X_candidate - 200) end = min(max_A + 1, X_candidate + 200) for x in range(start, end + 1): candidates.add(x) candidates.add(max_A) candidates.add(max_A + 1) # Check all candidates and find the minimal min_f = None best_x = None for x in sorted(candidates): fx = compute_f(x) if min_f is None or fx < min_f or (fx == min_f and x < best_x): min_f = fx best_x = x print(best_x) print(min_f) if __name__ == "__main__": main()