#coding: UTF-8
N=int(input())
p=[int(input()) for i in range(0,N)]
maxv=p[1]-p[0]
buy=p[0]
for i in range(1,N):
    if p[i]-buy>maxv:
        maxv=p[i]-buy
    if p[i]<buy:
        buy=p[i]
print(maxv) N=int(input()) N int(input()) int input() input int(input()) for i in range(0,N) for i in range(0,N) i range(0,N) range 0 N for i in range(0,N) int(input()) int input() input p=[int(input()) for i in range(0,N)] p [int(input()) for i in range(0,N)] maxv=p[1]-p[0] maxv p[1]-p[0] p[1] p 1 p[0] p 0 buy=p[0] buy p[0] p 0 for i in range(1,N):
    if p[i]-buy>maxv:
        maxv=p[i]-buy
    if p[i]<buy:
        buy=p[i] i range(1,N) range 1 N if p[i]-buy>maxv:
        maxv=p[i]-buy
     p[i]-buy>maxv p[i]-buy p[i] p i buy maxv maxv=p[i]-buy maxv p[i]-buy p[i] p i buy if p[i]<buy:
        buy=p[i] p[i]<buy p[i] p i buy buy=p[i] buy p[i] p i print(maxv) print maxv N=int(input()) int(input()) N buy=p[i] p[i] buy p=[int(input()) for i in range(0,N)] [int(input()) for i in range(0,N)] p maxv=p[1]-p[0] p[1]-p[0] maxv maxv=p[i]-buy p[i]-buy maxv buy=p[0] p[0] buy
#coding: UTF-8
N=int(input())
p=[int(input()) for i in range(0,N)]
maxv=p[1]-p[0]
buy=p[0]
for i in range(1,N):
    if p[i]-buy>maxv:
        maxv=p[i]-buy
    if p[i]<buy:
        buy=p[i]
print(maxv)