#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;
using llong = long long;
using ullong = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()
#define loop(i, times) for (llong i = 0; i < times; i++)
#define rloop(i, times) for (llong i = times -1; 0 <= i; i--)

std::chrono::system_clock::time_point  start;

void TimeStart(void)
{
	start = std::chrono::system_clock::now();
}

void TimeEnd(void)
{
	auto time = std::chrono::system_clock::now() - start;
	auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(time).count();
	cerr << endl << msec << " msec " << endl;
}

#endif


class NyaGadgetCpp17
{
public:
	/**
	@brief 最大公約数を計算する関数
	@note
	 aとbの最大公約数を返す
	**/
	template <typename T> static T Gcd(T a, T b)
	{
		return b ? Gcd(b, a % b) : a;
	}
};


class ABC125C
{
public:
	ABC125C()
	{
		cin >> n_;

		a_.resize(n_);
		loop(i, n_)
			cin >> a_[i];
	}
	void Run(void)
	{
		llong output = 0;

		CreateMemo1();
		CreateMemo2();

		loop(i, n_)
			output = max(output, CalcGCD(i));
		
		cout << output;
	}
private:
	llong CalcGCD(llong remove_index)
	{
		llong ans = 0;

		if (remove_index == 0)
		{
			ans = memo2_[n_ - remove_index - 2];
			return ans;
		}

		if (remove_index == n_ -1)
		{
			ans = memo1_[remove_index - 1];
			return ans;
		}

		ans = NyaGadgetCpp17::Gcd<llong>(memo1_[remove_index - 1], memo2_[n_-remove_index-2]);
		return ans;
	}
	void CreateMemo1(void)
	{
		memo1_.resize(n_);
		memo1_[0] = a_[0];
		for (llong i = 1; i < n_; i++)
		{
			memo1_[i] = NyaGadgetCpp17::Gcd<llong>(memo1_[i - 1], a_[i]);
		}
	}

	void CreateMemo2(void)
	{
		memo2_.resize(n_);
		memo2_[0] = a_.back();
		for(llong i = 1; i < n_; i++)
		{
			memo2_[i] = NyaGadgetCpp17::Gcd<llong>(memo2_[i - 1], a_[n_ - i - 1]);
		}
	}
	llong n_;
	vector<llong> a_;
	vector<llong> memo1_;
	vector<llong> memo2_;
};


int main(void)
{
	ABC125C abc125c;
	abc125c.Run();

	return 0;
}

Measured memory_bytes: 2560