program main
    implicit none
    integer :: i,n,j
    integer,dimension(:),allocatable :: x
    integer :: mx,mn,power,ptmp

    read *,n
    allocate(x(n))
    read *,(x(i),i=1,n)
    mx=maxval(x)
    mn=minval(x)
    power=1000000000
    do i=mn,mx
        ptmp=0
        do j=1,n
            ptmp=ptmp+(i-x(j))**2
        end do
        power=min(power,ptmp)
    end do
    print '(i0)',power
end program main