import scala.io.StdIn.readInt
import scala.io.Source.stdin

object Main {
   def main(args: Array[String]) = {
     val n = readInt()
     val r0 = readInt()
     val r1 = readInt()
     var max = r1 - r0
     var min = if(r0 > r1) r1 else r0

     for( m <- stdin.getLines().map { _.toInt} ) {
         if( max < m - min) {
         max = m - min
         if( min > m )
           min = m
       }
       else if( min > m ) {
         min = m
       }
     }
     println(max)
  }
}