import scala.io.{StdIn => in}

object Main extends App {
  val n = in.readInt
  val ms = in.readLine.split(" ").map(_.toInt).sorted

  val eMin = ms.filter(_%2 == 0)./:(Int.MaxValue)((acc,i) => {
    val v = i % acc
    (math.min(acc, if(v!=0) v else acc))
  })
  val oMin = ms.filter(_%2 == 1)./:(Int.MaxValue)((acc,i) => {
    val v = i % acc
    (math.min(acc, if(v!=0) v else acc))
  })

  val eoMin = math.min(eMin,oMin)
  // println(dMin)

  val eRes = if(oMin == 1) 1
    else ms.filter(_%2 == 0)./:(Int.MaxValue)((acc,i) => {
    val v = i % oMin
    val s = if(v != 0) v else acc
    math.min(acc,s)
  })
  val oRes = ms.filter(_%2 == 1)./:(Int.MaxValue)((acc,i) => {
    val v = i % eMin
    val s = if(v != 0) v else acc
    math.min(acc,s)
  })

  val minR = math.min(eRes,oRes)

  // println(min)
  val min = math.min(minR,eoMin)

  val ans = math.min(ms.head,min)
  println(ans)
}