
object Main extends App {

  import scala.io.StdIn._

  var n = readLine.toInt
  while (n != 0) {
    val scores = readLine.trim.split(' ').map(_.toInt).sorted
    println(
      (1 until n).map { i ⇒ scores(i) - scores(i - 1) }.min
    )
    n = readLine.toInt
  }
}

