n = int(raw_input())
R = [int(raw_input()) for i in xrange(n)]
mn = R[0]
ans = -1e10
for r in R[1:]:
    ans = max(ans, r - mn)
    mn = min(mn, r)
print ans n = int(raw_input()) n int(raw_input()) int raw_input() raw_input int(raw_input()) for i in xrange(n) for i in xrange(n) i xrange(n) xrange n for i in xrange(n) int(raw_input()) int raw_input() raw_input R = [int(raw_input()) for i in xrange(n)] R [int(raw_input()) for i in xrange(n)] mn = R[0] mn R[0] R 0 ans = -1e10 ans -1e10 for r in R[1:]:
    ans = max(ans, r - mn)
    mn = min(mn, r) r R[1:] R 1: 1 ans = max(ans, r - mn) ans max(ans, r - mn) max ans r - mn r mn mn = min(mn, r) mn min(mn, r) min mn r print mn = R[0] R[0] mn mn = min(mn, r) min(mn, r) mn ans = -1e10 -1e10 ans R = [int(raw_input()) for i in xrange(n)] [int(raw_input()) for i in xrange(n)] R ans = max(ans, r - mn) max(ans, r - mn) ans n = int(raw_input()) int(raw_input()) n
n = int(raw_input())
R = [int(raw_input()) for i in xrange(n)]
mn = R[0]
ans = -1e10
for r in R[1:]:
    ans = max(ans, r - mn)
    mn = min(mn, r)
print ans