import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = IntArray(n) { sc.nextInt() }

    fun gcd(a: Int, b: Int): Int {
        val c = a % b
        return if (c == 0) b else gcd(b, c)
    }

    val ret = a.reduce { acc, i -> gcd(acc, i) }
    println(ret)
}