object Main {
  def main(args: Array[String]) {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt
    var z = sc.nextInt
    var w = sc.nextInt
    val an = List.fill(n)(sc.nextInt)



    val sortedAn = an.sorted
    z = an.last
    val min = sortedAn.head
    if ( w > min ) {
      w = min
    }
    val ans1 = Math.abs(z - w)

    w = an.last
    val max = sortedAn.last
    if ( z < max ) {
      z = max
    }
    val ans2 = Math.abs(z - w)


    println(if (ans1 > ans2) ans1 else ans2)
  }
}
