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

mins = [a[0]]
for i in range(1, N):
    mins.append(min(a[i], mins[i-1]))
    
mx = -10**12
for j in range(1, N):
    mx = max(mx, a[j] - mins[j-1])
print(mx) 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 mins = [a[0]] mins [a[0]] a[0] a 0 for i in range(1, N):
    mins.append(min(a[i], mins[i-1]))
     i range(1, N) range 1 N mins.append(min(a[i], mins[i-1])) mins.append mins append min(a[i], mins[i-1]) min a[i] a i mins[i-1] mins i-1 i 1 mx = -10**12 mx -10**12 -10 12 for j in range(1, N):
    mx = max(mx, a[j] - mins[j-1]) j range(1, N) range 1 N mx = max(mx, a[j] - mins[j-1]) mx max(mx, a[j] - mins[j-1]) max mx a[j] - mins[j-1] a[j] a j mins[j-1] mins j-1 j 1 print(mx) print mx N = int(input()) int(input()) N mins = [a[0]] [a[0]] mins mx = max(mx, a[j] - mins[j-1]) max(mx, a[j] - mins[j-1]) mx mx = -10**12 -10**12 mx a = [] [] a
N = int(input())
a = []
for i in range(N):
    a.append(int(input()))

mins = [a[0]]
for i in range(1, N):
    mins.append(min(a[i], mins[i-1]))
    
mx = -10**12
for j in range(1, N):
    mx = max(mx, a[j] - mins[j-1])
print(mx)