N = int(input())
A = [int(input()) for i in range(N)]
max_v = A[1] - A[0]

l = 0
r = 1
while r + 1 < N:
    if A[l] > A[r]:
        l = r
    elif A[r] > A[r + 1]:
        max_v = max(max_v, A[r] - A[l])
        if A[l] > A[r + 1]:
            l = r + 1
            r = l
    r += 1
if r<N:
    max_v = max(max_v, A[r] - A[l])
print(max_v) N = int(input()) N int(input()) int input() input int(input()) for i in range(N) for i in range(N) i range(N) range N for i in range(N) int(input()) int input() input A = [int(input()) for i in range(N)] A [int(input()) for i in range(N)] max_v = A[1] - A[0] max_v A[1] - A[0] A[1] A 1 A[0] A 0 l = 0 l 0 r = 1 r 1 while r + 1 < N:
    if A[l] > A[r]:
        l = r
    elif A[r] > A[r + 1]:
        max_v = max(max_v, A[r] - A[l])
        if A[l] > A[r + 1]:
            l = r + 1
            r = l
    r += 1 r + 1 < N r + 1 r 1 N if A[l] > A[r]:
        l = r
    elif A[r] > A[r + 1]:
        max_v = max(max_v, A[r] - A[l])
        if A[l] > A[r + 1]:
            l = r + 1
            r = l
     A[l] > A[r] A[l] A l A[r] A r l = r l r elif A[r] > A[r + 1]:
        max_v = max(max_v, A[r] - A[l])
        if A[l] > A[r + 1]:
            l = r + 1
            r = l
     A[r] > A[r + 1] A[r] A r A[r + 1] A r + 1 r 1 max_v = max(max_v, A[r] - A[l]) max_v max(max_v, A[r] - A[l]) max max_v A[r] - A[l] A[r] A r A[l] A l if A[l] > A[r + 1]:
            l = r + 1
            r = l
     A[l] > A[r + 1] A[l] A l A[r + 1] A r + 1 r 1 l = r + 1 l r + 1 r 1 r = l r l r += 1 r 1 if r<N:
    max_v = max(max_v, A[r] - A[l]) r<N r N max_v = max(max_v, A[r] - A[l]) max_v max(max_v, A[r] - A[l]) max max_v A[r] - A[l] A[r] A r A[l] A l print(max_v) print max_v l = r r l r = 1 1 r N = int(input()) int(input()) N l = 0 0 l r += 1 1 r max_v = A[1] - A[0] A[1] - A[0] max_v max_v = max(max_v, A[r] - A[l]) max(max_v, A[r] - A[l]) max_v r = l l r l = r + 1 r + 1 l A = [int(input()) for i in range(N)] [int(input()) for i in range(N)] A max_v = max(max_v, A[r] - A[l]) max(max_v, A[r] - A[l]) max_v
N = int(input())
A = [int(input()) for i in range(N)]
max_v = A[1] - A[0]

l = 0
r = 1
while r + 1 < N:
    if A[l] > A[r]:
        l = r
    elif A[r] > A[r + 1]:
        max_v = max(max_v, A[r] - A[l])
        if A[l] > A[r + 1]:
            l = r + 1
            r = l
    r += 1
if r<N:
    max_v = max(max_v, A[r] - A[l])
print(max_v)