import scala.io.{StdIn => in}
import annotation.tailrec

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

  @tailrec
  def gcd(a:Int, b:Int):Int = {
    if(b== 0) a
    else gcd(b, a%b)
  }

  val ans = ms reduce gcd
  println(ans)
}