Altar Alignment


Submit solution

Points: 1
Time limit: 1.5s
Memory limit: 256M

Author:
Problem type
Allowed languages
C, C++, Java, Python

In the ancient temple of Thoth, the priests have prepared n altars with offerings of valuables, each with a certain weight. However, everyone knows that Thoth likes order and symmetry, so the priest has ensured that all the offerings weigh the same, modulo some hidden constant d. As an outlooker, you want to learn the ways of this temple by deciphering the largest such d given the weight of each offering.

Input

The first line contains a single integer n (2 \leq n \leq 10^5), the number of offerings presented on the altars.

The next line contains n space-separated integers x_1\ \dots\ x_n (1 \leq x_i \leq 10^6). Each x_i represents the weight of the ith offering. The priest assures you that we cannot have all x_i be the same, as that would cause d to be possibly infinite, displeasing Thoth.

Output

Output the largest integer d such that all x_i are equal modulo d.

I.e. the largest d such that, for some fixed integer r, x_i \equiv r\mod d for all i\in \{1,2,\dots,n\}.

Example

Input 1
4
6 10 18 14
Output 1
4

These offerings all weigh 2 modulo 4.

Input 2
3
10067 67 167
Output 2
100
Input 3
5
4 5 10 2 9
Output 3
1

Comments

There are no comments at the moment.