import Data.List (sort)

main :: IO ()
main = do
  _ <- getLine
  xs <- sort . map read . words <$> getLine
  print $ minD xs
  print $ maxD xs

minD :: [Int] -> Int
minD = minimum . map (\ (x, y) -> y - x) . pairs
  where
    pairs (x : y : xs) = (x, y) : pairs (y : xs)
    pairs _ = []

maxD :: [Int] -> Int
maxD = (-) <$> last <*> head