import Data.List

solve :: [Int] -> Int
solve xs = minimum $ map (\i -> step xs i) [0..100]
    where
        step xs i = sum $ map (\x -> (i-x)^2) xs


main = do
    n <- readLn :: IO Int
    xs <- map read . words <$> getLine :: IO [Int]
    print $ solve xs