import java.util.Scanner

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val monsters = (0 until n).map {
        sc.nextInt()
    }
    val distinct = monsters.distinct()
    if (monsters.distinct().size == 1) {
        // すべて同じ
        println(monsters.first())
        return
    }
    val min = monsters.min()!!
    val useCases = monsters.filter { it % min != 0 }
    if (useCases.isEmpty()) {
        // 最小の値に収束する
        println(min)
        return
    }
    val useMax = useCases.max()!!
    val divider = useMax % min
    // 相互に引き合う
    println(min(min, divider))
    return
}

tailrec fun min(a:Int, b: Int): Int {
    if (a == b) return a
    return if (a > b) {
        val diff = a - b
        min(diff, b)
    } else {
        val diff = b - a
        min(diff, a)
    }
}