object Main extends App {
  var N = readInt
  var get = readLine.split(" ")
  var max = 0
  var min = 1000000001
  for(i <- 0 until N){
    max = math.max(max,get(i).toInt)
    min = math.min(min,get(i).toInt)
  }
  while(max > min){
    if(max % min != 0){
	    min = max % min
    }
    max = min
  }
  println(min)
}