Problem6009--数列的公约数

6009: 数列的公约数

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 256 MiB

Description

给一个正整数序列 $a_1,\ …,\ a_n$,求数列 $a_1,\ …,\ a_n$ 的最大公约数,即 $\text{GCD}(a_1,\ …,\ a_n)$。

Input

第一行一个整数 $n\ (1 ≤ n ≤ 2⋅10^5)$.
第二行包括 $n$ 个整数 $a_1,\ …,\ a_n\ (1 ≤ a_i ≤ 10^{18})$.

Output

一个整数,表示答案。

Sample 1 Input

4
1 25 121 169

Sample 1 Output

1

Sample 2 Input

4
1 2 7 23

Sample 2 Output

1

Sample 3 Input

2
10 20

Sample 3 Output

10

3
1000000000 1000000000 1000000000

1000000000

Source/Category