n = int(input())

maxv = -20000000000

minv = int(input())

for i in range(n-1):
    R = int(input())
    maxv = max(maxv, R - minv)
    minv = min(minv, R)

print(maxv) n = int(input()) n int(input()) int input() input maxv = -20000000000 maxv -20000000000 minv = int(input()) minv int(input()) int input() input for i in range(n-1):
    R = int(input())
    maxv = max(maxv, R - minv)
    minv = min(minv, R) i range(n-1) range n-1 n 1 R = int(input()) R int(input()) int input() input maxv = max(maxv, R - minv) maxv max(maxv, R - minv) max maxv R - minv R minv minv = min(minv, R) minv min(minv, R) min minv R print(maxv) print maxv minv = min(minv, R) min(minv, R) minv n = int(input()) int(input()) n maxv = -20000000000 -20000000000 maxv maxv = max(maxv, R - minv) max(maxv, R - minv) maxv R = int(input()) int(input()) R minv = int(input()) int(input()) minv
n = int(input())

maxv = -20000000000

minv = int(input())

for i in range(n-1):
    R = int(input())
    maxv = max(maxv, R - minv)
    minv = min(minv, R)

print(maxv)