import std.stdio;
import std.conv;
import std.array;
import std.algorithm;

void main()
{
    int N = readln.split[0].to!int;
    int[] A = readln.split.to!(int[]);

    sort(A);

    int ans = A[1];
    while (ans >= 2){
        int cnt = 0;
        foreach (a; A){
            if (a % ans > 0) cnt++;
            if (cnt >= 2) break;
        }

        if (cnt <= 1) break;
        else ans--;
    }

    writeln(ans);
}

