n = int(input())
arr = [int(input()) for i in range(n)]

m = 1 - 10**9
minv = arr[0]
for i in range(1,len(arr)):
    if arr[i] - minv > m:
        m = arr[i] - minv
    minv = min(minv, arr[i])
print(m)     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 arr = [int(input()) for i in range(n)] arr [int(input()) for i in range(n)] m = 1 - 10**9 m 1 - 10**9 1 10**9 10 9 minv = arr[0] minv arr[0] arr 0 for i in range(1,len(arr)):
    if arr[i] - minv > m:
        m = arr[i] - minv
    minv = min(minv, arr[i]) i range(1,len(arr)) range 1 len(arr) len arr if arr[i] - minv > m:
        m = arr[i] - minv
     arr[i] - minv > m arr[i] - minv arr[i] arr i minv m m = arr[i] - minv m arr[i] - minv arr[i] arr i minv minv = min(minv, arr[i]) minv min(minv, arr[i]) min minv arr[i] arr i print(m) print m m = 1 - 10**9 1 - 10**9 m minv = min(minv, arr[i]) min(minv, arr[i]) minv n = int(input()) int(input()) n minv = arr[0] arr[0] minv arr = [int(input()) for i in range(n)] [int(input()) for i in range(n)] arr m = arr[i] - minv arr[i] - minv m
n = int(input())
arr = [int(input()) for i in range(n)]

m = 1 - 10**9
minv = arr[0]
for i in range(1,len(arr)):
    if arr[i] - minv > m:
        m = arr[i] - minv
    minv = min(minv, arr[i])
print(m)    