program ABC156_C
  integer,dimension(:),allocatable::X
  integer,dimension(1:101)::Y=0
  read(5,*)N
  allocate(X(N))
  read(5,*)X
  do I=1,101
     do J=1,N
        Y(I)=Y(I)+(X(J)-I+1)**2
     end do
  end do
  write(6,*)Y(minloc(Y))
end program ABC156_C