function gcd(arr) {
    var f = (a, b) => b ? f(b, a % b) : a
    var ans = arr[0]
    for (var i = 1; i < arr.length; i++) {
        ans = f(ans, arr[i]); 
    }
    return ans 
}

function main(arg) {
	var arg = arg.split("\n")
	arg = arg[1].split(" ").map(Number)

	arg.sort((a, b) => a - b)

	var result = gcd(arg)

	console.log(result)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));