n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
maxv=a[1]-a[0]
minv=a[0]
for j in range(1,n):
    maxv=max(maxv,a[j]-minv)
    minv=min(minv,a[j])
print(maxv)
     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 maxv=a[1]-a[0] maxv a[1]-a[0] a[1] a 1 a[0] a 0 minv=a[0] minv a[0] a 0 for j in range(1,n):
    maxv=max(maxv,a[j]-minv)
    minv=min(minv,a[j]) j range(1,n) range 1 n maxv=max(maxv,a[j]-minv) maxv max(maxv,a[j]-minv) max maxv a[j]-minv a[j] a j minv minv=min(minv,a[j]) minv min(minv,a[j]) min minv a[j] a j print(maxv) print maxv maxv=max(maxv,a[j]-minv) max(maxv,a[j]-minv) maxv a=[] [] a minv=min(minv,a[j]) min(minv,a[j]) minv n=int(input()) int(input()) n maxv=a[1]-a[0] a[1]-a[0] maxv minv=a[0] a[0] minv
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
maxv=a[1]-a[0]
minv=a[0]
for j in range(1,n):
    maxv=max(maxv,a[j]-minv)
    minv=min(minv,a[j])
print(maxv)
    
