function gcd(a,b){
  if(b==0){return a;}
  return gcd(b, a%b);
}

function main(input) {
  const formatted_input = input.split('\n');

  const N = parseInt(formatted_input[0], 10);
  const As = formatted_input[1].split(' ').map(x => parseInt(x));

  var L = [];
  var R = [];
  for( var i = 0 ; i<N ; i++ ){
    var l_tmp = 0;
    var r_tmp = 0;
    for(var j = 0 ; j < N ; j++){
      if(j<i){
        l_tmp = gcd(l_tmp, As[j]);
      }else if((j > i)){
        r_tmp = gcd(r_tmp, As[j]);
      }
    }
    L.push(l_tmp);
    R.push(r_tmp);
  }

  var results = [];
  for( var i = 0 ; i < N ; i++ ){
    results.push(gcd(L[i],R[i]));
  }


  console.log(results.sort().reverse()[0]);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


