let solve monsters =
  let min_hp = List.hd monsters in
  let monsters = List.tl monsters in
  let rec inner cur_min =
    let ls = List.filter (fun e -> e mod cur_min <> 0) monsters in
    match ls with
    | [] -> cur_min
    | ls -> 
       List.fold_left (fun me e -> min me (e mod cur_min)) max_int ls |> inner
  in inner min_hp

let _ =
  let n = Scanf.scanf "%d\n" (fun n -> n) in
  let monsters = ref [] in
  for i = 0 to n - 1 do
    Scanf.scanf (if i <> n - 1 then "%d " else "%d\n") 
      (fun m -> monsters := m::!monsters)
  done;
  List.sort (compare) !monsters
  |> solve |> print_int
