import fractions                                                                                                                                             
                                                                                                                                                             
if __name__ == '__main__':                                                                                                                                   
    N = int(input())                                                                                                                                         
    A = list(map(int,input().split()))                                                                                                                       
                                                                                                                                                             
    L = [0] * N                                                                                                                                              
    R = [0] * N                                                                                                                                              
                                                                                                                                                             
    L[0] = A[0]                                                                                                                                              
    for i in range(1,N):                                                                                                                                     
        L[i] = fractions.gcd(L[i-1],A[i])                                                                                                                    
                                                                                                                                                             
    R[-1] = A[-1]                                                                                                                                            
    for i in range(N-2,-1,-1):                                                                                                                               
        R[i] = fractions.gcd(R[i+1],A[i])                                                                                                                    
                                                                                                                                                             
    res = max(R[1],L[-2])                                                                                                                                    
    for i in range(1,N-1):                                                                                                                                   
        res = max(res,fractions.gcd(L[i-1],R[i+1]))                                                                                                          
                                                                                                                                                             
    print(res)

Measured memory_bytes: 16576