import scala.math._
import scala.annotation._
import scala.collection._
import scala.collection.{mutable => mut}
import scala.util.control.Breaks.{breakable,break}

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

    val n = sc.nextInt
    var as = Seq.fill(n)(sc.nextInt)

    as.indices.foreach { i =>
      as = as.map { a =>
        val mod = a % as(i)
        if(mod == 0) a else mod
      }
    }
    println(as.min)
  }
}