from fractions import gcd



N = int(eval(input()))

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



a = sorted(A)

B = [a[0]]

C = []

for i in range(1,N):

    x = a[i]%a[0]

    if x != 0:

        B.append(x)

b =sorted(B)

for i in range(len(b)-1):

    y = gcd(b[i],b[-1])

    C.append(y)

    

if len(b) == 1:

    print((b[0]))

else:

    print((min(C)))
from fractions import gcd



N = int(eval(input()))

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



mini = min(A)

ans = min(A)

for a in A:

    amari = a % mini

    if amari != 0:

        if amari < ans:

            ans = amari            

if mini - ans == 0:

    print(ans)

else:

    print((gcd(mini, ans)))
from fractions import gcd

N = int(eval(input()))
A = list(map(int, input().split()))
a = sorted(A)
B = [a[0]]
C = []
for i in range(1, N):
    x = a[i] % a[0]
    if x != 0:
        B.append(x)
b = sorted(B)
for i in range(len(b) - 1):
    y = gcd(b[i], b[-1])
    C.append(y)
if len(b) == 1:
    print((b[0]))
else:
    print((min(C)))

from fractions import gcd

N = int(eval(input()))
A = list(map(int, input().split()))
mini = min(A)
ans = min(A)
for a in A:
    amari = a % mini
    if amari != 0:
        if amari < ans:
            ans = amari
if mini - ans == 0:
    print(ans)
else:
    print((gcd(mini, ans)))

-a = sorted(A) -B = [a[0]] -C = [] -for i in range(1, N): -    x = a[i] % a[0] -    if x != 0: -        B.append(x) -b = sorted(B) -for i in range(len(b) - 1): -    y = gcd(b[i], b[-1]) -    C.append(y) -if len(b) == 1: -    print((b[0])) +mini = min(A) +ans = min(A) +for a in A: +    amari = a % mini +    if amari != 0: +        if amari < ans: +            ans = amari +if mini - ans == 0: +    print(ans) -    print((min(C))) +    print((gcd(mini, ans)))