import sys



N=int(eval(input()))

HP=list(map(int,input().split()))



a=HP[0]

b=HP[1]



(x, lastx) = (0, 1)

(y, lasty) = (1, 0)

while b != 0:

    q = a // b

    (a, b) = (b, a % b)

    (x, lastx) = (lastx - q * x, x)

    (y, lasty) = (lasty - q * y, y)

        

tmp=a



for i in range(1,N-1):

    a=tmp

    b=HP[i+1]

    

    (x, lastx) = (0, 1)

    (y, lasty) = (1, 0)

    while b != 0:

        q = a // b

        (a, b) = (b, a % b)

        (x, lastx) = (lastx - q * x, x)

        (y, lasty) = (lasty - q * y, y)

        

    tmp=a

    if tmp==1:

        print(tmp)

        sys.exit()

    

print(tmp)
from fractions import gcd

 

N=int(eval(input()))

HP=list(map(int,input().split()))

 

tmp=HP[0]

 

for i in range(0,N):

    tmp=gcd(tmp,HP[i])

    

print(tmp)
import sys

N = int(eval(input()))
HP = list(map(int, input().split()))
a = HP[0]
b = HP[1]
(x, lastx) = (0, 1)
(y, lasty) = (1, 0)
while b != 0:
    q = a // b
    (a, b) = (b, a % b)
    (x, lastx) = (lastx - q * x, x)
    (y, lasty) = (lasty - q * y, y)
tmp = a
for i in range(1, N - 1):
    a = tmp
    b = HP[i + 1]
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    tmp = a
    if tmp == 1:
        print(tmp)
        sys.exit()
print(tmp)

from fractions import gcd

N = int(eval(input()))
HP = list(map(int, input().split()))
tmp = HP[0]
for i in range(0, N):
    tmp = gcd(tmp, HP[i])
print(tmp)

-import sys +from fractions import gcd -a = HP[0] -b = HP[1] -(x, lastx) = (0, 1) -(y, lasty) = (1, 0) -while b != 0: -    q = a // b -    (a, b) = (b, a % b) -    (x, lastx) = (lastx - q * x, x) -    (y, lasty) = (lasty - q * y, y) -tmp = a -for i in range(1, N - 1): -    a = tmp -    b = HP[i + 1] -    (x, lastx) = (0, 1) -    (y, lasty) = (1, 0) -    while b != 0: -        q = a // b -        (a, b) = (b, a % b) -        (x, lastx) = (lastx - q * x, x) -        (y, lasty) = (lasty - q * y, y) -    tmp = a -    if tmp == 1: -        print(tmp) -        sys.exit() +tmp = HP[0] +for i in range(0, N): +    tmp = gcd(tmp, HP[i])