n = input()
R = [input() for i in xrange(n)]

Rmin = n
maxdif = R[1] - R[0]

while Rmin > 0:
    tRmin = R.index(min(R[0:Rmin]))
    Rmax = R.index(max(R[tRmin:Rmin]))
    if tRmin == Rmax:
        if tRmin == n-1:
            tRmin-=1
        elif tRmin < n-1:
            Rmax = tRmin + 1
    Rmin = tRmin
    if (R[Rmax] - R[Rmin]) > maxdif:
        maxdif = R[Rmax] - R[Rmin]

print maxdif n = input() n input() input input() for i in xrange(n) for i in xrange(n) i xrange(n) xrange n for i in xrange(n) input() input R = [input() for i in xrange(n)] R [input() for i in xrange(n)] Rmin = n Rmin n maxdif = R[1] - R[0] maxdif R[1] - R[0] R[1] R 1 R[0] R 0 while Rmin > 0:
    tRmin = R.index(min(R[0:Rmin]))
    Rmax = R.index(max(R[tRmin:Rmin]))
    if tRmin == Rmax:
        if tRmin == n-1:
            tRmin-=1
        elif tRmin < n-1:
            Rmax = tRmin + 1
    Rmin = tRmin
    if (R[Rmax] - R[Rmin]) > maxdif:
        maxdif = R[Rmax] - R[Rmin] Rmin > 0 Rmin 0 tRmin = R.index(min(R[0:Rmin])) tRmin R.index(min(R[0:Rmin])) R.index R index min(R[0:Rmin]) min R[0:Rmin] R 0:Rmin 0 Rmin Rmax = R.index(max(R[tRmin:Rmin])) Rmax R.index(max(R[tRmin:Rmin])) R.index R index max(R[tRmin:Rmin]) max R[tRmin:Rmin] R tRmin:Rmin tRmin Rmin if tRmin == Rmax:
        if tRmin == n-1:
            tRmin-=1
        elif tRmin < n-1:
            Rmax = tRmin + 1
     tRmin == Rmax tRmin Rmax if tRmin == n-1:
            tRmin-=1
        elif tRmin < n-1:
            Rmax = tRmin + 1
     tRmin == n-1 tRmin n-1 n 1 tRmin-=1 tRmin 1 elif tRmin < n-1:
            Rmax = tRmin + 1
     tRmin < n-1 tRmin n-1 n 1 Rmax = tRmin + 1 Rmax tRmin + 1 tRmin 1 Rmin = tRmin Rmin tRmin if (R[Rmax] - R[Rmin]) > maxdif:
        maxdif = R[Rmax] - R[Rmin] (R[Rmax] - R[Rmin]) > maxdif R[Rmax] - R[Rmin] R[Rmax] R Rmax R[Rmin] R Rmin maxdif maxdif = R[Rmax] - R[Rmin] maxdif R[Rmax] - R[Rmin] R[Rmax] R Rmax R[Rmin] R Rmin print Rmin = n n Rmin tRmin = R.index(min(R[0:Rmin])) R.index(min(R[0:Rmin])) tRmin R = [input() for i in xrange(n)] [input() for i in xrange(n)] R maxdif = R[Rmax] - R[Rmin] R[Rmax] - R[Rmin] maxdif maxdif = R[1] - R[0] R[1] - R[0] maxdif tRmin-=1 1 tRmin Rmax = tRmin + 1 tRmin + 1 Rmax Rmin = tRmin tRmin Rmin n = input() input() n Rmax = R.index(max(R[tRmin:Rmin])) R.index(max(R[tRmin:Rmin])) Rmax
n = input()
R = [input() for i in xrange(n)]

Rmin = n
maxdif = R[1] - R[0]

while Rmin > 0:
    tRmin = R.index(min(R[0:Rmin]))
    Rmax = R.index(max(R[tRmin:Rmin]))
    if tRmin == Rmax:
        if tRmin == n-1:
            tRmin-=1
        elif tRmin < n-1:
            Rmax = tRmin + 1
    Rmin = tRmin
    if (R[Rmax] - R[Rmin]) > maxdif:
        maxdif = R[Rmax] - R[Rmin]

print maxdif