import scala.math._ object Main { def main(args: Array[String]) = { val sc = new java.util.Scanner(System.in) val n = sc.nextInt val xs = (1 to n).map { _ => sc.nextInt }.toSet.toArray.sorted // println(xs.mkString(" ")) var ans = if (xs.size <= 1) 0 else xs(1) - xs(0) for (i <- 1 to xs.size-1) { ans = min(ans, xs(i) - xs(i-1)) } println(ans) } }