'use strict';

function Main(input) {
  const N = Number(input.split("\n")[0])
  const A = input.split("\n")[1].split(" ").map(x => Number(x)).sort((a, b) => a > b ? 1 : -1)

  if (N === 2) {
    console.log(Math.max.apply(null, A))
    return
  }

  const min = A[0]
  const booby = A[1]
  let list = [1]

  for (let i=2; i<min; i++) {
    if (min % i === 0) {
      list.push(i)
    }
  }
  for (let i=2; i<booby; i++) {
    if (min % i === 0) {
      list.push(i)
    }
  }

  list = list.sort((a, b) => a > b ? -1 : 1)

  let chance = true

  for (let num of list) {
    for (let i=0; i<N; i++) {
      if (A[i] % num !== 0) {
        if (!chance) {
          chance = true
          break
        }
        chance = false
      }
      if (i === N-1) {
        console.log(num)
        return
      }
    }
  }

};

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
