program main
  implicit none
  integer :: n, i, j, sum = -1, csum = 0
  integer, allocatable :: x(:)

  read *, n
  allocate (x(n))
  read *, x

  do i = 1, 100
    csum = 0
    do j = 1, n
      csum = csum + (x(j) - i) ** 2
    end do
    if (csum < sum .or. i == 1) sum = csum
  end do
  print '(i0)', sum
end program