n = gets.chomp.to_i
a = gets.chomp.split(' ').map(&:to_i)

while true do
  a.sort!
  
  while true do
    if a[0] > 0 then
      break
    end
    a.shift
  end
  
  
  if a.size == 1 then
    break
  end
  
  m = a[0]
  
  (1...a.size).each do |i|
    a[i] = a[i] % m
  end
end
  
puts a[0].to_s