main::IO()
main = do
    _ <- getLine
    s <- words <$> getLine
    let x = map read s :: [Int]
    print $ minimum $ fnc x 1
    
fnc :: [Int] -> Int -> [Int]
fnc _ 101 = []
fnc x p = [sum $map ((^2) . (+(-p))) x] ++ fnc x (p+1)