fun main(args: Array<String>) {

    val N = readLine()!!.toInt()
    val AX = readLine()!!.split(" ").map(String::toLong)

    fun gcd(a: Long, b: Long): Long {
        return if (b > 0) gcd(b, a % b) else a
    }

    AX.reduce { acc, e -> gcd(acc, e) }.let(::println)

}
