N = int(input())
M = -1000000000
L = int(input())
for i in range(1,N):
    C = int(input())
    M = max(C - L, M)
    L = min(C, L)
print(M) N = int(input()) N int(input()) int input() input M = -1000000000 M -1000000000 L = int(input()) L int(input()) int input() input for i in range(1,N):
    C = int(input())
    M = max(C - L, M)
    L = min(C, L) i range(1,N) range 1 N C = int(input()) C int(input()) int input() input M = max(C - L, M) M max(C - L, M) max C - L C L M L = min(C, L) L min(C, L) min C L print(M) print M M = max(C - L, M) max(C - L, M) M M = -1000000000 -1000000000 M C = int(input()) int(input()) C N = int(input()) int(input()) N L = min(C, L) min(C, L) L L = int(input()) int(input()) L
N = int(input())
M = -1000000000
L = int(input())
for i in range(1,N):
    C = int(input())
    M = max(C - L, M)
    L = min(C, L)
print(M)