import sys
n = int(raw_input())
R = [int(raw_input()) for i in xrange(n)]
minimum = sys.maxint
maximum = -sys.maxint - 1
for x in R:
    p = x - minimum
    if maximum < p:
        maximum = p

    if minimum > x:
        minimum = x
print maximum import sys sys n = int(raw_input()) n int(raw_input()) int raw_input() raw_input int(raw_input()) for i in xrange(n) for i in xrange(n) i xrange(n) xrange n for i in xrange(n) int(raw_input()) int raw_input() raw_input R = [int(raw_input()) for i in xrange(n)] R [int(raw_input()) for i in xrange(n)] minimum = sys.maxint minimum sys.maxint sys maxint maximum = -sys.maxint - 1 maximum -sys.maxint - 1 -sys.maxint sys.maxint sys maxint 1 for x in R:
    p = x - minimum
    if maximum < p:
        maximum = p

    if minimum > x:
        minimum = x x R p = x - minimum p x - minimum x minimum if maximum < p:
        maximum = p

     maximum < p maximum p maximum = p maximum p if minimum > x:
        minimum = x minimum > x minimum x minimum = x minimum x print n = int(raw_input()) int(raw_input()) n minimum = x x minimum R = [int(raw_input()) for i in xrange(n)] [int(raw_input()) for i in xrange(n)] R minimum = sys.maxint sys.maxint minimum p = x - minimum x - minimum p maximum = -sys.maxint - 1 -sys.maxint - 1 maximum maximum = p p maximum
import sys
n = int(raw_input())
R = [int(raw_input()) for i in xrange(n)]
minimum = sys.maxint
maximum = -sys.maxint - 1
for x in R:
    p = x - minimum
    if maximum < p:
        maximum = p

    if minimum > x:
        minimum = x
print maximum