void main()
{
    long n = readln.chomp.to!long;
    long[] a = readln.split.to!(long[]);

    long[] l = new long[n+1];
    foreach (i; 0 .. n)
    {
        l[i+1] = gcd(l[i], a[i]);
    }

    long[] r = new long[n+1];
    foreach_reverse (i; 0 .. n)
    {
        r[i] = gcd(r[i+1], a[i]);
    }

    long result;
    foreach (i; 0 .. n)
    {
        result = max(result, gcd(l[i], r[i+1]));
    }

    result.writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;