N = input()
R = [int(raw_input()) for _ in xrange(N)]
S = [0 for i in xrange(N)]
S[N-1] = R[N-1]
for i in xrange(N-2, -1, -1):
    S[i] = max(R[i], S[i+1])
ans = float('-inf')
for i in xrange(N-1):
    ans = max(ans, S[i+1]-R[i])
print ans N = input() N input() input int(raw_input()) for _ in xrange(N) for _ in xrange(N) _ xrange(N) xrange N for _ in xrange(N) int(raw_input()) int raw_input() raw_input R = [int(raw_input()) for _ in xrange(N)] R [int(raw_input()) for _ in xrange(N)] 0 for i in xrange(N) for i in xrange(N) i xrange(N) xrange N for i in xrange(N) 0 S = [0 for i in xrange(N)] S [0 for i in xrange(N)] S[N-1] = R[N-1] S[N-1] S N-1 N 1 R[N-1] R N-1 N 1 for i in xrange(N-2, -1, -1):
    S[i] = max(R[i], S[i+1]) i xrange(N-2, -1, -1) xrange N-2 N 2 -1 -1 S[i] = max(R[i], S[i+1]) S[i] S i max(R[i], S[i+1]) max R[i] R i S[i+1] S i+1 i 1 ans = float('-inf') ans float('-inf') float '-inf' for i in xrange(N-1):
    ans = max(ans, S[i+1]-R[i]) i xrange(N-1) xrange N-1 N 1 ans = max(ans, S[i+1]-R[i]) ans max(ans, S[i+1]-R[i]) max ans S[i+1]-R[i] S[i+1] S i+1 i 1 R[i] R i print ans = float('-inf') float('-inf') ans N = input() input() N ans = max(ans, S[i+1]-R[i]) max(ans, S[i+1]-R[i]) ans R = [int(raw_input()) for _ in xrange(N)] [int(raw_input()) for _ in xrange(N)] R S = [0 for i in xrange(N)] [0 for i in xrange(N)] S
N = input()
R = [int(raw_input()) for _ in xrange(N)]
S = [0 for i in xrange(N)]
S[N-1] = R[N-1]
for i in xrange(N-2, -1, -1):
    S[i] = max(R[i], S[i+1])
ans = float('-inf')
for i in xrange(N-1):
    ans = max(ans, S[i+1]-R[i])
print ans