12053 - Greatest Common Divisor   

Description

Calculate the greatest common divisor of multiple positive integers.

Definition of greatest common divisor: if d is a common divisor of a set of positive integer S, then for all element i in S, d|i. The greatest common divisor is the largest d satisfy the above condition.

 

Input

Input consists of 2 lines.

The first line contains a integer N, representing the # of positive integers.

The second line contains N positive integers. Numbers are seperated by a space.

It is guaranteed that

  • N <= 10000
  • All positive integers <= 2*1012

Output

Print out the greatest common divisor of these positive integers.

 

Sample Input  Download

Sample Output  Download

Tags




Discuss