#P7191. Finding All Valid Divisors
Finding All Valid Divisors
Finding All Valid Divisors
Luka writes down integers (from the numbers on license plates) on a piece of paper. Then he tries to find an integer , with , such that when each of these numbers is divided by , they all give the same remainder. In other words, for all given integers , the condition [ a_i \equiv r \pmod{m} ] holds for some remainder (which might be different for different inputs), and must be greater than 1. Luka wants to find as many different values of as possible. Your task is to write a program that, given the integers, determines all possible values that satisfy the condition.
Note: Two numbers giving the same remainder modulo is equivalent to saying that divides the difference of any two of the numbers. Thus, if you compute the greatest common divisor ((g)) of all differences, then any divisor of (g) will be a valid answer.
inputFormat
The first line of input contains an integer , representing the number of integers. The second line contains space-separated integers. It is guaranteed that the integers are not all the same.
outputFormat
Output all valid integers (greater than 1) in increasing order, separated by a single space.
sample
3
38 6 34
2 4