GCD of Everything
Print the greatest common divisor of all N values.
Input: the first line has N; the second line has N positive integers.
Output: gcd(a1, ..., aN).
Constraints:
- 1 ≤ N ≤ 105
- 1 ≤ ai ≤ 109
Sample Tests
Input 1
3 12 18 24
Output 1
6
Input 2
2 7 13
Output 2
1
Discussion (opens after you solve — no spoilers before)
No comments yet.