n = int(input())
R = (int(input()) for _ in range(n))
ret = -(10 ** 9)
mn = next(R)
for r in R:
    ret = max(ret, r - mn)
    mn = min(mn, r)
print(ret) n = int(input()) n int(input()) int input() input int(input()) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) int(input()) int input() input R = (int(input()) for _ in range(n)) R (int(input()) for _ in range(n)) ret = -(10 ** 9) ret -(10 ** 9) 10 ** 9 10 9 mn = next(R) mn next(R) next R for r in R:
    ret = max(ret, r - mn)
    mn = min(mn, r) r R ret = max(ret, r - mn) ret max(ret, r - mn) max ret r - mn r mn mn = min(mn, r) mn min(mn, r) min mn r print(ret) print ret mn = next(R) next(R) mn ret = max(ret, r - mn) max(ret, r - mn) ret mn = min(mn, r) min(mn, r) mn ret = -(10 ** 9) -(10 ** 9) ret n = int(input()) int(input()) n R = (int(input()) for _ in range(n)) (int(input()) for _ in range(n)) R
n = int(input())
R = (int(input()) for _ in range(n))
ret = -(10 ** 9)
mn = next(R)
for r in R:
    ret = max(ret, r - mn)
    mn = min(mn, r)
print(ret)