n = int(input())
i, j = int(input()), 0
nmin = i
a = -2 * 10 ** 9
for h in range(n - 1):
    j = int(input())
    a = max(a, j - nmin)
    if j < nmin:
        nmin = j

print(a) n = int(input()) n int(input()) int input() input i, j = int(input()), 0 i int(input()) int input() input j 0 nmin = i nmin i a = -2 * 10 ** 9 a -2 * 10 ** 9 -2 10 ** 9 10 9 for h in range(n - 1):
    j = int(input())
    a = max(a, j - nmin)
    if j < nmin:
        nmin = j h range(n - 1) range n - 1 n 1 j = int(input()) j int(input()) int input() input a = max(a, j - nmin) a max(a, j - nmin) max a j - nmin j nmin if j < nmin:
        nmin = j j < nmin j nmin nmin = j nmin j print(a) print a a = -2 * 10 ** 9 -2 * 10 ** 9 a n = int(input()) int(input()) n a = max(a, j - nmin) max(a, j - nmin) a nmin = i i nmin j = int(input()), 0 0 j i, j = int(input()), 0 int(input()) i nmin = j j nmin j = int(input()) int(input()) j
n = int(input())
i, j = int(input()), 0
nmin = i
a = -2 * 10 ** 9
for h in range(n - 1):
    j = int(input())
    a = max(a, j - nmin)
    if j < nmin:
        nmin = j

print(a)