let rec gcd a b = if b = 0 then a else gcd b (a mod b)
let () =
  let n = Scanf.scanf "%d\n" (fun x -> x) in
  let lst = Array.to_list
      (Array.init n (fun _ -> Scanf.scanf "%d " (fun x -> x))) in
  let head = List.hd lst in
  let tail = List.tl lst in
  Printf.printf "%d\n" (List.fold_left gcd head tail)