using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

using static Input;
using static Util;
class Program
{
    static void Main(string[] args)
    {
        var N = NextInt();
        var A = LineLong();
        var st = new SegmentTree<long>(N, (a,b) => GCD(a, b), 0);
        for (int i = 0; i < A.Length; i++)
        {
            st.set(i, A[i]);
        }

        var max = long.MinValue;
        for (int i = 0; i < N; i++)
        {
            max = Math.Max(max, GCD(st.prod(0, i), st.prod(i + 1, N)));
        }
        Console.WriteLine(max);
    }
}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{
    /// <summary>
    /// 最大公約数
    /// </summary>
    /// <param name="a"></param>
    /// <param name="b"></param>
    /// <returns></returns>
    public static long GCD(long a, long b)
    {
        if (b == 0) return a;
        return GCD(b, a % b);
    }

    public class SegmentTree<val>
        where val : struct
    {
        private int size;
        private val[] vals;
        private Func<val, val, val> op;
        private val def;
        /// <summary>
        /// SegmentTree
        /// </summary>
        /// <param name="n">ノード数</param>
        /// <param name="op">更新処理</param>
        /// <param name="def">初期値</param>
        public SegmentTree(int n, Func<val, val, val> op, val def)
        {
            this.op = op;
            this.def = def;

            size = 1;
            while (size < n) size <<= 1;
            
            vals = new val[size * 2 - 1];

            for (int i = 0; i < vals.Length; i++)
            {
                vals[i] = def;
            }
        }

        /// <summary>
        /// 値更新
        /// </summary>
        /// <param name="idx">ノードインデックス</param>
        /// <param name="val">更新値</param>
        public void set(int idx, val val)
        {
            idx += size - 1;
            vals[idx] = val;
            while (idx > 0)
            {
                idx = (idx - 1) / 2;
                vals[idx] = op(vals[idx * 2 + 1], vals[idx * 2 + 2]);
            }
        }

        /// <summary>
        /// 値取得
        /// </summary>
        /// <returns></returns>
        public val prod()
        {
            return vals[0];
        }
        /// <summary>
        /// 値取得 [a,b)
        /// </summary>
        /// <param name="a">左インデックス [</param>
        /// <param name="b">右インデックス )</param>
        /// <returns></returns>
        public val prod(int a, int b)
        {
            return prod(a, b, 0, 0, size);
        }
        private val prod(int a, int b, int k, int l, int r)
        {
            if (r <= a || b <= l) return def;
            if (a <= l && r <= b) return vals[k];
            else
            {
                var vl = prod(a, b, k * 2 + 1, l, (l + r) / 2);
                var vr = prod(a, b, k * 2 + 2, (l + r) / 2, r);
                return op(vl, vr);
            }
        }
    }
}


Measured memory_bytes: 36056