import Control.Monad
import Data.List

main = do
    n <- readLn :: IO Int
    xn <- map read . words <$> getLine :: IO [Int]
    let minN = minimum xn
    let maxN = maximum xn
    print $ minimum $ map (\p -> sum $ map (\x -> (x - p)^2) xn ) [minN..maxN]