object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val ls = in.map(_.split(' ').map(_.toInt).toArray).tail.head
  val s = ls.distinct.sorted
  
  var lastMin = s.head
  var min = Int.MaxValue
  var ss = s.toSeq
  do {
    lastMin = min
    val d = (1 until ss.size).map(i => ss(i) - ss(i-1))
    ss ++= d
    //ss = ss.sorted.distinct
    ss = ss.distinct.sorted
    min = ss.head
    //println(ss.toSeq)
  }while(lastMin != min)
  println(min)
}
