program example
	implicit none

	integer :: N, P, i, wa=0
    integer,allocatable :: X(:)
    
    read(*,*) N
    
    allocate(X(N))
    
    read(*,*) X
    
    P=idnint(sum(X(:))/dble(N))
    
    do i=1,N
    	wa=wa+(X(i)-P)**2
	end do
    
    write(*,*) wa

end program example
