import std.algorithm;
import std.bigint;
import std.concurrency;
import std.container;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.meta;
import std.numeric;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;


auto solve(long N, long[] A) {
    auto t = SegmentTree!(long, gcd, 0L)(A);
    return iota(N).map!(i => gcd(t[0 .. i], t[i + 1 .. $])).reduce!max;
}


void main() {
    auto input = stdin.byLine.map!split.joiner;

    long N;
    N = input.front.to!long;
    input.popFront;

    long[] A = new long[](N);
    foreach (i; 0 .. N) {
        A[i] = input.front.to!long;
        input.popFront;
    }

    static if (is(ReturnType!solve == void))
        solve(N, A);
    else
        solve(N, A).writeln;
}


struct SegmentTree(M, alias f, alias e) if (
    is(typeof(e) == M)
) {
private:
    alias _f = binaryFun!f;

    long _size;
    long leaves;
    M[] data;

public:
    // constructor___________________________________________________
    this(long n) {
        _size = n;
        leaves = 1;
        while (leaves < n) leaves <<= 1;
        data.length = leaves << 1;
        data.fill(e);
    }

    this(R)(R range) if (
        isInputRange!R &&
        hasLength!R &&
        is(ElementType!R == M)
    ) {
        this(range.length);
        foreach (i; 0 .. range.length)
            data[leaves + i] = range[i];
        foreach_reverse(i; 1 .. leaves)
            data[i] = _f(data[i << 1], data[(i << 1) + 1]);
    }

    // query_________________________________________________________
    M opIndexAssign(M x, long i)
    in {
        assert(0 <= i && i < size, "Access Violation");
    }
    body {
        i += leaves;
        data[i] = x;
        while ((i >>= 1) != 0)
            data[i] = _f(data[i << 1], data[(i << 1) + 1]);
        
        return x;
    }

    M opIndex(long[2] range)
    in {
        // assert(0 <= range[0] && range[0] < size, "Access Violation");
        // assert(0 < range[1] && range[1] <= size, "Access Violation");
        // assert(range[0] < range[1], "Query Violation");
    }
    body {
        long l = range[0] + leaves;
        long r = range[1] + leaves;
        M vl = e;
        M vr = e;
        while (l < r) {
            if (l & 1)
                vl = _f(vl, data[l++]);
            if (r & 1)
                vr = _f(data[--r], vr);
            l >>= 1;
            r >>= 1;
        }

        return _f(vl, vr);
    }

    // utility_______________________________________________________
    M opIndex(long i)
    in {
        assert(0 <= i && i < size, "Access Violation");
    }
    body {
        return this[i .. i + 1];
    }
    
    M opIndexOpAssign(string op)(M x, long i) {
        mixin("this[i] = (this[i] %s x);".format(op));
        return this[i];
    }

    @property long size() {
        return _size;
    }

    long opDollar(long dim : 0)() {
        return size;
    }

    long[2] opSlice(long dim : 0)(long i, long j) {
        return [i, j];
    }
}
