信奥赛基础习题集—最大公约数

D. Greatest Common Divisor

单点时限: 3.0 sec

内存限制: 256 MB

Your task is to find a greatest common divisor(GCD) from given integers.

输入格式

Input consists from multiple test cases.The first line of each test case contains single positive integer n (1 < n < 1024) which indicates the number of integers to find a GCD. Next line contains n positive integers separated by a single space. You have to calculate a GCD from these integers. A single line containing 0 denotes the end of input.

You can assume that input integers always fit in 32-bit signed integer.

输出格式

For each test case, you should output a GCD for each line.

样例

Input
2
4 10
0
Output
2