import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)

    val n = sc.nextInt()
    val as = Array.fill(n)(sc.nextInt())

    println(as.fold(as.head)((a, b) => gcd(a, b)))

    @scala.annotation.tailrec
    def gcd(a: Int, b: Int): Int = {
      if (b == 0) a else gcd(b, a % b)
    }
  }
  def debug(args: Any*): Unit = {
    Console.err.println(args.mkString(" "))
  }
}
