import           Control.Monad (replicateM)
import           Data.List     (permutations)

main :: IO ()
main = do
  n <- readLn
  as <- replicateM n readLn
  print $ f as

f :: [Int] -> Int
f = maximum . map (\as -> sum $ zipWith ((abs .) . subtract) as (tail as)) . permutations
