import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)

    val n = sc.nextInt()
    val nums = List.fill(n)(sc.nextInt)

    @scala.annotation.tailrec
    def solve(list: List[Int]): Int = list match {
      case List(a) => a
      case _ => {
        val min = list.min
        val nextList = list.map(_ % min).filter(_ > 0)

        solve(min :: nextList)
      }
    }

    println(solve(nums))
  }
}
