Time limit
2s
Memory limit
128 MB
For integers N and D, let Q be the quotient and R be the remainder when N is divided by D. Then R = N - Q × D.
You are given a sequence of n integers. There may be an integer D such that every number in the sequence leaves the same remainder when divided by D. Depending on the sequence, several such values of D may exist.
Find the largest possible D for the given sequence.
The first line contains n (1 ≤ n ≤ 1,000). The second line contains n integers whose absolute values do not exceed 1,000,000.
Print the largest possible D on the first line. The input is guaranteed to be a case where such a largest value exists.