#coding: UTF-8

N = int(input())

a = [int(input()) for i in range(N)]

ans = set()

maxv = -9999999999
minv = a[0]
for i in range(1,N):
    if (a[i] - minv) > maxv:
        maxv = a[i] - minv
    if a[i] < minv:
        minv = a[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 a = [int(input()) for i in range(N)] a [int(input()) for i in range(N)] ans = set() ans set() set maxv = -9999999999 maxv -9999999999 minv = a[0] minv a[0] a 0 for i in range(1,N):
    if (a[i] - minv) > maxv:
        maxv = a[i] - minv
    if a[i] < minv:
        minv = a[i] i range(1,N) range 1 N if (a[i] - minv) > maxv:
        maxv = a[i] - minv
     (a[i] - minv) > maxv a[i] - minv a[i] a i minv maxv maxv = a[i] - minv maxv a[i] - minv a[i] a i minv if a[i] < minv:
        minv = a[i] a[i] < minv a[i] a i minv minv = a[i] minv a[i] a i print(maxv) print maxv minv = a[i] a[i] minv minv = a[0] a[0] minv maxv = a[i] - minv a[i] - minv maxv a = [int(input()) for i in range(N)] [int(input()) for i in range(N)] a N = int(input()) int(input()) N maxv = -9999999999 -9999999999 maxv ans = set() set() ans
#coding: UTF-8

N = int(input())

a = [int(input()) for i in range(N)]

ans = set()

maxv = -9999999999
minv = a[0]
for i in range(1,N):
    if (a[i] - minv) > maxv:
        maxv = a[i] - minv
    if a[i] < minv:
        minv = a[i]

print(maxv)