[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

let gcd x y =
    let rec aux x y = if y = 0 then x else aux y (x % y)
    aux (abs x) (abs y)

[<EntryPoint>]
let main _ =
    let n = read int
    let xs = reads int
    List.reduce (fun s x -> gcd x s) xs
    |> printfn "%i"
    0