from math import gcd import sys input=sys.stdin.buffer.readline N=int(input()) A=list(map(int,input().split())) n=N.bit_length() _GCD=[[0 for i in range(n)] for i in range(N)] for i in range(N): _GCD[i][0]=A[i] for j in range(1,n): for i in range(N-2**j+1): _GCD[i][j]=gcd(_GCD[i][j-1],_GCD[i+2**(j-1)][j-1])