• + 0 comments

    from math import gcd as g n = int(input().strip())

    a = list(map(int, input().rstrip().split()))

    if len(a) == 1: print(a[0] + 1) else:**

    pre = [0] * len(a)
    suf = [0] * len(a)
    
    for i in range(len(a)):
        if i == 0:
            pre[i] = a[i]
        else:
            pre[i] = g(pre[i - 1], a[i])
    
    for i in range(len(a)-1, -1, -1):
        if i == len(a) - 1:
            suf[i] = a[i]
        else:
            suf[i] = g(suf[i + 1], a[i])
    
    final_prefix = []
    
    for i in range(len(a)):
        if i == 0:
            final_prefix.append(suf[i + 1])
        elif i == len(a) - 1:
            final_prefix.append(pre[i - 1])
        else:
            final_prefix.append(g(pre[i - 1], suf[i + 1]))
    
    net = {}
    
    for i in final_prefix:
        if i in net:
            net[i] += 1
        else:
            net[i] = 1
    
    for i in net:
        if net[i] == 1:
            ans = i
            break
    
    print(ans)