fun main(args: Array<String>) {
    readLine()
    readLine()!!.split(" ").map { it.toInt() }
        .reduce { acc, i -> gcd(acc,i) }
        .let { println(it) }
}

fun gcd(a:Int,b:Int):Int = if(b==0) a else gcd(b,a%b)