n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

maxv = -(10**9)
mina = a[0]

for i in range(1,n):
    maxv = max(maxv, a[i]-mina)
    mina = min(mina, a[i])

print(maxv) n = int(input()) n int(input()) int input() input a = [] a [] for i in range(n):
    a.append(int(input())) i range(n) range n a.append(int(input())) a.append a append int(input()) int input() input maxv = -(10**9) maxv -(10**9) 10**9 10 9 mina = a[0] mina a[0] a 0 for i in range(1,n):
    maxv = max(maxv, a[i]-mina)
    mina = min(mina, a[i]) i range(1,n) range 1 n maxv = max(maxv, a[i]-mina) maxv max(maxv, a[i]-mina) max maxv a[i]-mina a[i] a i mina mina = min(mina, a[i]) mina min(mina, a[i]) min mina a[i] a i print(maxv) print maxv a = [] [] a n = int(input()) int(input()) n mina = a[0] a[0] mina maxv = max(maxv, a[i]-mina) max(maxv, a[i]-mina) maxv maxv = -(10**9) -(10**9) maxv mina = min(mina, a[i]) min(mina, a[i]) mina
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

maxv = -(10**9)
mina = a[0]

for i in range(1,n):
    maxv = max(maxv, a[i]-mina)
    mina = min(mina, a[i])

print(maxv)