fun main(args: Array<String>){
    readLine()!!.toInt()
    var inputList = readLine()!!.split(" ").map{ it.toInt() }.toMutableList()
    while (true) {
        inputList.filter { it > 0 }
        inputList.sort()
        val x = inputList[0]
        inputList = inputList.drop(1).map {
            it % x
        }.filter{ it > 0 }.toMutableList()
        inputList.add(x)
        if (inputList.size <= 1) {
            println(x)
            break
        }
    }
}