module Main where

import Control.Applicative
import Control.Monad
import Data.List

main :: IO ()
main = do
    [_, x] <- fmap read . words <$> getLine :: IO [Int]
    xs <- fmap read . words <$> getLine :: IO [Int]
    let ys = sort (x:xs)
    let d = minimum $ fmap (\(a,b) -> b-a) $ zip ys (tail ys)
    let f d = let r = (head ys) `mod` d
              in all (== r) (fmap (`mod` d) ys)
    let ans = head $ filter f [d, d-1 .. 1]
    print ans