import scala.io.StdIn._

object Main extends App {

  val n = readInt()
  val A = readLine().split(" ").map(_.toInt)

  def solve() = {
    rec(A, A.min)
  }

  def rec(list: Array[Int], divider: Int): Int = {
    if(list.isEmpty) divider
    else {
      val filtered = list.collect {
        case num if num % divider != 0 => num % divider
      }
      if(filtered.nonEmpty && divider > filtered.min) {
        rec(divider +: filtered, filtered.min)
      } else rec(filtered, divider)
    }
  }

  println(solve())

}

