N = int(input())
list_price = [int(input()) for i in range(N)]
minv = list_price[0]
maxv = -10**9
for x in list_price[1:]:
    maxv = max(maxv, x - minv)
    minv = min(minv, x)        
print(maxv) 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 list_price = [int(input()) for i in range(N)] list_price [int(input()) for i in range(N)] minv = list_price[0] minv list_price[0] list_price 0 maxv = -10**9 maxv -10**9 -10 9 for x in list_price[1:]:
    maxv = max(maxv, x - minv)
    minv = min(minv, x)         x list_price[1:] list_price 1: 1 maxv = max(maxv, x - minv) maxv max(maxv, x - minv) max maxv x - minv x minv minv = min(minv, x) minv min(minv, x) min minv x print(maxv) print maxv maxv = -10**9 -10**9 maxv list_price = [int(input()) for i in range(N)] [int(input()) for i in range(N)] list_price N = int(input()) int(input()) N minv = min(minv, x) min(minv, x) minv maxv = max(maxv, x - minv) max(maxv, x - minv) maxv minv = list_price[0] list_price[0] minv
N = int(input())
list_price = [int(input()) for i in range(N)]
minv = list_price[0]
maxv = -10**9
for x in list_price[1:]:
    maxv = max(maxv, x - minv)
    minv = min(minv, x)        
print(maxv)