{-
	AOJ #1608
	title: Selection of Participants of an Experiment
	@kankichi573
-}
import Data.List
main = do n <- getLine
          args <- getContents
          let mylist  =  map s2Int (words args)
	  let mylist2 = sort $ zipWith diff mylist (tail mylist)
	  print $ head mylist2

s2Int :: String -> Int
s2Int str = read str :: Int

diff :: Int -> Int -> Int
diff a b = if a > b then a - b else b - a 

     