import java.util.Scanner

fun main(args: Array<String>) {
    val s = Scanner(System.`in`)
    val n = s.nextInt()
    val a: MutableList<Int> = mutableListOf()
    for (i in 1..n) {
        a.add(s.nextInt())
    }

    println(solve(a))
}

fun solve(a: List<Int>): Int {
    var r: Int = 0
    for (i in a) {
        r = gcd(r, i)
    }
    return r
}

fun gcd(a: Int, b: Int): Int {
    if (b == 0) {
        return a
    }

    return gcd(b, a % b)
}
