n = int(input())
r = [int(input()) for x in range(n)]
maxv = -2000000000
minv = r[0]

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

print(maxv) n = int(input()) n int(input()) int input() input int(input()) for x in range(n) for x in range(n) x range(n) range n for x in range(n) int(input()) int input() input r = [int(input()) for x in range(n)] r [int(input()) for x in range(n)] maxv = -2000000000 maxv -2000000000 minv = r[0] minv r[0] r 0 for i in range(1, n):
    maxv = max(maxv, r[i] - minv)
    minv = min(minv, r[i]) i range(1, n) range 1 n maxv = max(maxv, r[i] - minv) maxv max(maxv, r[i] - minv) max maxv r[i] - minv r[i] r i minv minv = min(minv, r[i]) minv min(minv, r[i]) min minv r[i] r i print(maxv) print maxv r = [int(input()) for x in range(n)] [int(input()) for x in range(n)] r minv = min(minv, r[i]) min(minv, r[i]) minv maxv = -2000000000 -2000000000 maxv minv = r[0] r[0] minv n = int(input()) int(input()) n maxv = max(maxv, r[i] - minv) max(maxv, r[i] - minv) maxv
n = int(input())
r = [int(input()) for x in range(n)]
maxv = -2000000000
minv = r[0]

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

print(maxv)