   program abc156c
      implicit none
      integer::N,i,p
      integer(8)::sumX,sumA=100000000
      integer,allocatable,dimension(:)::X

      read *,N
      allocate(X(N))
      read *,X(1:N)

      do p=1,100
         sumX=0
         do i=1,N
            sumX=sumX+(X(i)-p)**2
         end do
         if (sumX<sumA) sumA=sumX
      end do
      print *,sumA
      stop

   end program abc156c