n = int(input())
values = [int(input()) for i in range(n)]

maxv = -999999999
minimum = values[0]

for i in range(1, n):
    if values[i] - minimum > maxv:
        maxv = values[i] - minimum
    if values[i] < minimum:
        minimum = values[i]

print(maxv) n = int(input()) n int(input()) int input() input int(input()) for i in range(n) for i in range(n) i range(n) range n for i in range(n) int(input()) int input() input values = [int(input()) for i in range(n)] values [int(input()) for i in range(n)] maxv = -999999999 maxv -999999999 minimum = values[0] minimum values[0] values 0 for i in range(1, n):
    if values[i] - minimum > maxv:
        maxv = values[i] - minimum
    if values[i] < minimum:
        minimum = values[i] i range(1, n) range 1 n if values[i] - minimum > maxv:
        maxv = values[i] - minimum
     values[i] - minimum > maxv values[i] - minimum values[i] values i minimum maxv maxv = values[i] - minimum maxv values[i] - minimum values[i] values i minimum if values[i] < minimum:
        minimum = values[i] values[i] < minimum values[i] values i minimum minimum = values[i] minimum values[i] values i print(maxv) print maxv minimum = values[i] values[i] minimum n = int(input()) int(input()) n minimum = values[0] values[0] minimum values = [int(input()) for i in range(n)] [int(input()) for i in range(n)] values maxv = -999999999 -999999999 maxv maxv = values[i] - minimum values[i] - minimum maxv
n = int(input())
values = [int(input()) for i in range(n)]

maxv = -999999999
minimum = values[0]

for i in range(1, n):
    if values[i] - minimum > maxv:
        maxv = values[i] - minimum
    if values[i] < minimum:
        minimum = values[i]

print(maxv)