Ksusha is a beginner coder. Today she starts studying arrays. She has array *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub>, consisting of *n* positive integers.

Her university teacher gave her a task. Find such number in the array, that all array elements are divisible by it. Help her and find the number!
The first line contains integer *n* (1 ≤ *n* ≤ 10<sup class="upper-index">5</sup>), showing how many numbers the array has. The next line contains integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>) — the array elements.
def MergeSort(myList):
    #Function that splits the list in halves to recursively split them and return the merged halves
    if(len(myList) == 1):
        return myList
    mid = len(myList)//2
    list1 = myList[:mid]
    list2 = myList[mid:]

    list1 = MergeSort(list1)
    list2 = MergeSort(list2)

    return Merge(list1, list2)

def Merge(A, B):
    #Function that receives the 2 halves of a list and merges them in order to return one ordered list
    C = []
    i = 0
    j = 0
    while(i<len(A) and j<len(B)):
        if(A[i] < B[j]):
            C.append(A[i])
            i +=1
        else:
            C.append(B[j])
            j +=1
            
    while(i<len(A)):
        C.append(A[i])
        i +=1

    while(j<len(B)):
        C.append(B[j])
        j +=1
   
    return C


def findNumber(myList, n):
    for i in range(0, len(myList)):
        aux1 = 0
        aux2 = myList[i]
        for j in range(0, len(myList)):
            if(myList[j] % aux2 == 0 ):
                aux1 += 1

        if(n == aux1):
            return aux2

    return -1


myList = []

n = int(input())

numbers = input().split(" ")

for i in range(0, n):
    myList.append(int(numbers[i]))

#myList = MergeSort(myList)

print(findNumber(myList, n))

