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

ma = L[1]-L[0]
mi = L[0]
for x in range(n-1):
    ma = max([ma,L[x+1]-mi])
    mi = min(mi,L[x+1])


print (ma) n = int(input()) n int(input()) int input() input L =[] L [] for i in range(n):
    x = int(input())
    L.append(x) i range(n) range n x = int(input()) x int(input()) int input() input L.append(x) L.append L append x ma = L[1]-L[0] ma L[1]-L[0] L[1] L 1 L[0] L 0 mi = L[0] mi L[0] L 0 for x in range(n-1):
    ma = max([ma,L[x+1]-mi])
    mi = min(mi,L[x+1]) x range(n-1) range n-1 n 1 ma = max([ma,L[x+1]-mi]) ma max([ma,L[x+1]-mi]) max [ma,L[x+1]-mi] ma L[x+1]-mi L[x+1] L x+1 x 1 mi mi = min(mi,L[x+1]) mi min(mi,L[x+1]) min mi L[x+1] L x+1 x 1 print (ma) print ma mi = min(mi,L[x+1]) min(mi,L[x+1]) mi n = int(input()) int(input()) n ma = L[1]-L[0] L[1]-L[0] ma x = int(input()) int(input()) x L =[] [] L mi = L[0] L[0] mi ma = max([ma,L[x+1]-mi]) max([ma,L[x+1]-mi]) ma
n = int(input())
L =[]
for i in range(n):
    x = int(input())
    L.append(x)

ma = L[1]-L[0]
mi = L[0]
for x in range(n-1):
    ma = max([ma,L[x+1]-mi])
    mi = min(mi,L[x+1])


print (ma)