N = int(eval(input()))

A = input().split(" ")

A = [int(i) for i in A]

list = [min(A)]

A = sorted(A)

iii = 0

while True:

    iii += 1

    if A[N-1] % A[N-2] != 0:

        A[N-1] = A[N-1] % A[N-2]

    elif N >= 3 and A[N-1] % A[N-3] != 0:

        A[N-1] = A[N-1] % A[N-3]

    elif N >= 4 and A[N-1] % A[N-4] != 0:

        A[N-1] = A[N-1] % A[N-4]

    elif N >= 5 and A[N-1] % A[N-5] != 0:

        A[N-1] = A[N-1] % A[N-5]



    A = sorted(A)

    list.append(min(A))

    if iii > 64:

        break       

#print(list)

for i in range(N-1):

    if A[i+1]-A[i] > 0:

        list.append(A[i+1]-A[i])

#print(list)

print((min(list)))
N = int(eval(input()))

A = input().split(" ")

A = [int(i) for i in A]

list = [min(A)]

A = sorted(A)

iii = 0

while True:

    iii += 1

    if A[N-1] % A[N-2] != 0:

        A[N-1] = A[N-1] % A[N-2]

    elif N >= 3 and A[N-1] % A[N-3] != 0:

        A[N-1] = A[N-1] % A[N-3]



    A = sorted(A)

    list.append(min(A))

    if iii > 32:

        break       

#print(list)

for i in range(N-1):

    if A[i+1]-A[i] > 0:

        list.append(A[i+1]-A[i])

#print(list)

print((min(list)))
N = int(eval(input()))
A = input().split(" ")
A = [int(i) for i in A]
list = [min(A)]
A = sorted(A)
iii = 0
while True:
    iii += 1
    if A[N - 1] % A[N - 2] != 0:
        A[N - 1] = A[N - 1] % A[N - 2]
    elif N >= 3 and A[N - 1] % A[N - 3] != 0:
        A[N - 1] = A[N - 1] % A[N - 3]
    elif N >= 4 and A[N - 1] % A[N - 4] != 0:
        A[N - 1] = A[N - 1] % A[N - 4]
    elif N >= 5 and A[N - 1] % A[N - 5] != 0:
        A[N - 1] = A[N - 1] % A[N - 5]
    A = sorted(A)
    list.append(min(A))
    if iii > 64:
        break
# print(list)
for i in range(N - 1):
    if A[i + 1] - A[i] > 0:
        list.append(A[i + 1] - A[i])
# print(list)
print((min(list)))

N = int(eval(input()))
A = input().split(" ")
A = [int(i) for i in A]
list = [min(A)]
A = sorted(A)
iii = 0
while True:
    iii += 1
    if A[N - 1] % A[N - 2] != 0:
        A[N - 1] = A[N - 1] % A[N - 2]
    elif N >= 3 and A[N - 1] % A[N - 3] != 0:
        A[N - 1] = A[N - 1] % A[N - 3]
    A = sorted(A)
    list.append(min(A))
    if iii > 32:
        break
# print(list)
for i in range(N - 1):
    if A[i + 1] - A[i] > 0:
        list.append(A[i + 1] - A[i])
# print(list)
print((min(list)))

-    elif N >= 4 and A[N - 1] % A[N - 4] != 0: -        A[N - 1] = A[N - 1] % A[N - 4] -    elif N >= 5 and A[N - 1] % A[N - 5] != 0: -        A[N - 1] = A[N - 1] % A[N - 5] -    if iii > 64: +    if iii > 32: