let N = stdin.ReadLine() |> int if N = 0 then 0 else stdin.ReadLine().Split(' ') |> Seq.map int |> Set.ofSeq |> Seq.pairwise |> Seq.map (fun (a,b) -> abs(a-b)) |> Seq.min |> printfn "%d"