import java.util.*

fun main(args: Array<String>) {

    val sc = Scanner(System.`in`)
    val N = sc.nextInt()

    var set = mutableSetOf<Long>()
    for (n in 0 until N) {
        val A = sc.nextLong()
        set.add(A)
    }
    var premin = set.min()!!
    while (true) {
        val newset = mutableSetOf<Long>()
        for (s in set) newset.add(s%premin)
        set = newset
        set.remove(0L)
        set.add(premin)
        if (set.size == 0) break
        val min = set.min()!!
        if (min == premin) break
        premin = min
    }

    println(premin)
}
