#P7191. Finding All Valid Divisors

    ID: 20395 Type: Default 1000ms 256MiB

Finding All Valid Divisors

Finding All Valid Divisors

Luka writes down nn integers (from the numbers on license plates) on a piece of paper. Then he tries to find an integer mm, with m>1m > 1, such that when each of these numbers is divided by mm, they all give the same remainder. In other words, for all given integers aia_i, the condition [ a_i \equiv r \pmod{m} ] holds for some remainder rr (which might be different for different inputs), and mm must be greater than 1. Luka wants to find as many different values of mm as possible. Your task is to write a program that, given the nn integers, determines all possible mm values that satisfy the condition.

Note: Two numbers giving the same remainder modulo mm is equivalent to saying that mm divides the difference of any two of the numbers. Thus, if you compute the greatest common divisor ((g)) of all differences, then any divisor m>1m > 1 of (g) will be a valid answer.

inputFormat

The first line of input contains an integer nn (2n100)(2 \le n \le 100), representing the number of integers. The second line contains nn space-separated integers. It is guaranteed that the integers are not all the same.

outputFormat

Output all valid integers mm (greater than 1) in increasing order, separated by a single space.

sample

3
38 6 34
2 4