inputs = fmap (read :: String -> Int) . words <$> getLine
input = (read :: String -> Int) <$> getLine

tuples n lst = do
    x <- [0..n-1]
    y <- [x+1..n-1]
    return (abs $ (lst !! x) - (lst !! y))

solve n xs = minimum <$> (tuples n <$> xs)

main = input >>= \n -> if n /= 0 
                          then print <$> solve n inputs >> main 
                          else do return ()