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