"use strict"

function gcd(array) {
    var f = (a, b) => b ? f(b, a % b) : a;
    var ans = array[0];
    for (var i = 1; i < array.length; i++) {
      ans = f(ans, array[i]); 
    }
    return ans;
}

function Main(input) {
  input = input.split('\n');
  let N = parseInt(input.shift());
  let array = input.shift().split(/\s/).map(value => value - 0);
  if(N == 2){
    console.log(array[0]>array[1]?array[0]:array[1]);
    return;
  }
  let result = 0;
  for (let i=0;i<N;i++){
    let tmp = array.shift();
    result = Math.max(gcd(array), result);
    array.push(tmp);
  }
  console.log(result);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
