#!/usr/bin/env python3
n = int(input())
R = []
for _ in range(n):
    i = int(input())
    R.append(i)

i = 0
j = 0
m = -float("inf")
while j < n - 1:
    j += 1
    if R[j] - R[i] > m:
        m = R[j] - R[i]
    if R[i] > R[j]:
        i = j
print(m) n = int(input()) n int(input()) int input() input R = [] R [] for _ in range(n):
    i = int(input())
    R.append(i) _ range(n) range n i = int(input()) i int(input()) int input() input R.append(i) R.append R append i i = 0 i 0 j = 0 j 0 m = -float("inf") m -float("inf") float("inf") float "inf" while j < n - 1:
    j += 1
    if R[j] - R[i] > m:
        m = R[j] - R[i]
    if R[i] > R[j]:
        i = j j < n - 1 j n - 1 n 1 j += 1 j 1 if R[j] - R[i] > m:
        m = R[j] - R[i]
     R[j] - R[i] > m R[j] - R[i] R[j] R j R[i] R i m m = R[j] - R[i] m R[j] - R[i] R[j] R j R[i] R i if R[i] > R[j]:
        i = j R[i] > R[j] R[i] R i R[j] R j i = j i j print(m) print m m = -float("inf") -float("inf") m j += 1 1 j R = [] [] R m = R[j] - R[i] R[j] - R[i] m i = int(input()) int(input()) i j = 0 0 j n = int(input()) int(input()) n i = j j i i = 0 0 i
#!/usr/bin/env python3
n = int(input())
R = []
for _ in range(n):
    i = int(input())
    R.append(i)

i = 0
j = 0
m = -float("inf")
while j < n - 1:
    j += 1
    if R[j] - R[i] > m:
        m = R[j] - R[i]
    if R[i] > R[j]:
        i = j
print(m)