main = do
  _ <- getLine
  as <- getLine >>= return . map read . words :: IO [Int]
  print $ maximum $ solve as
  where
    solve (_:[]) = []
    solve (x:xs) = (map (\y -> abs (x-y)) xs) ++ (solve xs)
  
