def divisors(n): lower,upper=[],[] i=1 while i*i<=n: if n%i==0: lower.append(i) if i!=n//i: upper.append(n//i) i+=1 return lower+upper[::-1] n=int(input()) a=list(map(int,input().split())) block=[] now=a[0] L=a[0] g=a[0] from math import gcd for i in range(1,n): if a[i]-a[i-1]!=1: g=gcd(g,a[i]) ans=10**9 ans2=-1 kouho=set() for d in divisors(len(a)): for i in range(-5,6): if d+i>0: kouho.add(d+i) for i in range(10): kouho.add(2*len(a)+i) if g!=0: for i in divisors(g): kouho.add(i) kouho=sorted(list(kouho)) for x in kouho: last=-1 cnt=0 for i in a: if i//x!=last: cnt+=1 last=i//x if ans>cnt*(x+1): ans=cnt*(x+1) ans2=x print(ans2) print(ans)