#yuki731 import numpy as np from functools import reduce n=int(raw_input()) l=np.array(map(float,raw_input().split())) a,b=np.polyfit(np.array(range(n)),l,1) print b,a res=0 for i in xrange(n): res+=(l[i]-b-a*i)**2 print res