import scala.io.StdIn._

object Main extends App {

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

  def solve() = {
    A.foldLeft(0) { (acc, num) =>
      gcd(acc, num)
    }
  }

  def gcd(x: Int, y: Int): Int =
    if(y == 0) x else gcd(y, x % y)

  println(solve())

}

