Altar Alignment
In the ancient temple of Thoth, the priests have prepared 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
. As an outlooker, you want to learn the ways of this temple by deciphering the largest such
given the weight of each offering.
Input
The first line contains a single integer (
), the number of offerings presented on the altars.
The next line contains space-separated integers
(
). Each
represents the weight of the
th offering. The priest assures you that we cannot have all
be the same, as that would cause
to be possibly infinite, displeasing Thoth.
Output
Output the largest integer such that all
are equal modulo
.
I.e. the largest such that, for some fixed integer
,
for all
.
Example
Input 1
4
6 10 18 14
Output 1
4
These offerings all weigh modulo
.
Input 2
3
10067 67 167
Output 2
100
Input 3
5
4 5 10 2 9
Output 3
1
Comments