import scala.io.StdIn object Solution { def main(args: Array[String]) { val n = StdIn.readInt() val numbers = StdIn.readLine().split(" ").map(_.toInt).toVector val sorted = numbers.sorted println((0 until n - 1).map(i => sorted(i + 1) - sorted(i)).min) } }