n = gets.to_i
monsters = gets.split(" ").map {|s| s.to_i}

remaining_monsters = monsters
while(remaining_monsters.size > 1) do
  previous_remaining_monsters = remaining_monsters
  remaining_monsters = []

  weekest = previous_remaining_monsters.min

  remaining_monsters.push(weekest)
  previous_remaining_monsters
  .reject {|monster| monster == weekest }
  .each { |monster|
    rest = monster % weekest
    if rest != 0 then
      remaining_monsters.push(rest)
    end
  }
end

puts(remaining_monsters[0])
