      PROGRAM rally
      IMPLICIT NONE
      integer(16) :: n,ans,val,best,i
      integer(16),allocatable :: x(:)
      
      read*,n
      allocate(x(n))
      read*,x(:)
      
      best = huge(best)
      do i = 1,100
        val = sum( (x(:)-i)*(x(:)-i) )
        
        if( val<=best )then
          best = val
          ans  = i
        end if
      end do
      
      print*,best
      
      
      
      END PROGRAM