object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val ls = in.map(_.split(' ').map(_.toInt).toIndexedSeq).tail.head

  var ss = ls.distinct.sorted
  var lastMin = Int.MaxValue
  var min = Int.MaxValue
  //var ss = s//.toIndexedSeq
  do {
    lastMin = min
    val d = (1 until ss.size).map(i => ss(i) - ss(i-1))
    //ss ++= d
    //ss = ss.sorted.distinct
    ss = (ss ++ d).distinct.sorted
    min = ss.head
    //println(ss.toSeq)
  }while(lastMin != min)
  println(min)
}
