N = gets.to_i
a = gets.split.map(&:to_i)
a.sort!

while a.size > 1 do
    int = a[0]
    b = a.map{|x| x % int}
    a.clear
    a << int
    a = a + b[1..-1]
    a.reject!{|x| x == 0}
    a.sort!
end

puts a