readInt :: String -> Int
readInt = read

main = do
    s <- map readInt.tail.words<$>getContents
    print $ solve s

solve s = foldr gcd v (convert s)
 where
  v = head (convert s)

convert [] = []
convert [a] = []
convert (a:b:x) = [abs(a-b)] ++ convert (b:x)