n = int(input())

rt = [input() for i in range(n)]

minv = int(rt[0])
maxv = int(rt[1]) - int(rt[0])

for j in range(1,n):
    maxv = max(maxv,int(rt[j]) - minv)
    minv = min(minv,int(rt[j]))

print(maxv) n = int(input()) n int(input()) int input() input input() for i in range(n) for i in range(n) i range(n) range n for i in range(n) input() input rt = [input() for i in range(n)] rt [input() for i in range(n)] minv = int(rt[0]) minv int(rt[0]) int rt[0] rt 0 maxv = int(rt[1]) - int(rt[0]) maxv int(rt[1]) - int(rt[0]) int(rt[1]) int rt[1] rt 1 int(rt[0]) int rt[0] rt 0 for j in range(1,n):
    maxv = max(maxv,int(rt[j]) - minv)
    minv = min(minv,int(rt[j])) j range(1,n) range 1 n maxv = max(maxv,int(rt[j]) - minv) maxv max(maxv,int(rt[j]) - minv) max maxv int(rt[j]) - minv int(rt[j]) int rt[j] rt j minv minv = min(minv,int(rt[j])) minv min(minv,int(rt[j])) min minv int(rt[j]) int rt[j] rt j print(maxv) print maxv minv = int(rt[0]) int(rt[0]) minv n = int(input()) int(input()) n maxv = max(maxv,int(rt[j]) - minv) max(maxv,int(rt[j]) - minv) maxv maxv = int(rt[1]) - int(rt[0]) int(rt[1]) - int(rt[0]) maxv minv = min(minv,int(rt[j])) min(minv,int(rt[j])) minv rt = [input() for i in range(n)] [input() for i in range(n)] rt
n = int(input())

rt = [input() for i in range(n)]

minv = int(rt[0])
maxv = int(rt[1]) - int(rt[0])

for j in range(1,n):
    maxv = max(maxv,int(rt[j]) - minv)
    minv = min(minv,int(rt[j]))

print(maxv)