AtCoder Beginner Contest 125
C
GCD on Blackboard
AtCoder
⌀ 1197
原题
← BD →
翻译中…

Problem Statement

翻译中…

There are $N$ integers, $A_1, A_2, ..., A_N$, written on the blackboard.

翻译中…

You will choose one of them and replace it with an integer of your choice between $1$ and $10^9$ (inclusive), possibly the same as the integer originally written.

翻译中…

Find the maximum possible greatest common divisor of the $N$ integers on the blackboard after your move.

翻译中…

Constraints

翻译中…
  • All values in input are integers.
  • $2 \leq N \leq 10^5$
  • $1 \leq A_i \leq 10^9$
翻译中…

Output

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
A_1 A_2 ... A_N

翻译中…

Output

翻译中…

Print the maximum possible greatest common divisor of the $N$ integers on the blackboard after your move.

翻译中…

样例

Input #1
3
7 6 8
Output #1
2
If we replace $7$ with $4$, the greatest common divisor of the three integers on the blackboard will be $2$, which is the maximum possible value.
Input #2
3
12 15 18
Output #2
6
Input #3
2
1000000000 1000000000
Output #3
1000000000
We can replace an integer with itself.
题目信息
题号
abc125_c
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。