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