import numpy n=int(input()) a=[*map(float,input().split())] b,d=numpy.polyfit(range(n),a,1) print(d,b,sum([(d+b*i-a[i])**2for i in range(n)]))