P7191 [COCI 2007/2008 #6] GRANICA

Description

Luka first wrote the numbers from $n$ license plates onto a piece of paper. Then, he tried to find an integer $m$ such that all the numbers on the paper leave the same remainder when divided by $m$. Luka wants to find as many different values of $m$ as possible. Write a program that, given Luka’s $n$ integers, determines all such $m$. Note that you must ensure $m$ is a positive integer, i.e., $m > 1$.

Input Format

The first line contains a positive integer $n$, the number of integers. In the next $n$ lines, each line contains an integer $a_i$, representing a number on the paper, and all $a_i$ are guaranteed to be distinct. The testdata guarantees that there exists at least one $m$ that satisfies the requirement.

Output Format

Output all values of $m$ that satisfy the requirement in any order on the first line.

Explanation/Hint

#### Sample #1 Explanation All integers leave remainder $0$ when divided by $2$, and remainder $2$ when divided by $4$. #### Constraints - For $60\%$ of the testdata, $2 \le n \le 100$, $1 \le a_i \le 10^4$. - For $100\%$ of the testdata, $2 \le n \le 100$, $1 \le a_i \le 10^9$. #### Notes - The full score for this problem is $50$ points. - This problem enables the O2 optimization switch by default. - Translated from [COCI2007-2008](https://hsin.hr/coci/archive/2007_2008/) [CONTEST #6](https://hsin.hr/coci/archive/2007_2008/contest6_tasks.pdf) T3 GRANICA. Translator: @[tearing](https://www.luogu.com.cn/user/219791). - Thanks to @[tiger2005](https://www.luogu.com.cn/user/60864) for providing the checker, which you can download from the attachments. Translated by ChatGPT 5