object Main extends App {
	// your code goes here
	import scala.io.StdIn.readLine
	while(true) {
		val n = readLine().toInt
		if (n == 0) System.exit(0)
		val list = readLine().split(" ").map(_.toInt)
		println(list.sorted.sliding(2).map{case Array(_1, _2) => _2 - _1}.min)
	}
}

