N = input()
R = [input() for i in range(N)]

min_v = float("inf")
ans = -float("inf")
for r in R:
    ans = max(ans, r - min_v)
    min_v = min(min_v, r)
    
print ans N = input() N 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 R = [input() for i in range(N)] R [input() for i in range(N)] min_v = float("inf") min_v float("inf") float "inf" ans = -float("inf") ans -float("inf") float("inf") float "inf" for r in R:
    ans = max(ans, r - min_v)
    min_v = min(min_v, r)
     r R ans = max(ans, r - min_v) ans max(ans, r - min_v) max ans r - min_v r min_v min_v = min(min_v, r) min_v min(min_v, r) min min_v r print min_v = float("inf") float("inf") min_v ans = max(ans, r - min_v) max(ans, r - min_v) ans N = input() input() N R = [input() for i in range(N)] [input() for i in range(N)] R ans = -float("inf") -float("inf") ans min_v = min(min_v, r) min(min_v, r) min_v
N = input()
R = [input() for i in range(N)]

min_v = float("inf")
ans = -float("inf")
for r in R:
    ans = max(ans, r - min_v)
    min_v = min(min_v, r)
    
print ans