n = int(input())
r = [int(input()) for _ in range(n)]

mi = r[0]
mx = -1e10
for j in range(1, len(r)):
    mx = max(mx, (r[j] - mi))
    mi = min(mi, r[j])
print(mx) n = int(input()) n int(input()) int input() input int(input()) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) int(input()) int input() input r = [int(input()) for _ in range(n)] r [int(input()) for _ in range(n)] mi = r[0] mi r[0] r 0 mx = -1e10 mx -1e10 for j in range(1, len(r)):
    mx = max(mx, (r[j] - mi))
    mi = min(mi, r[j]) j range(1, len(r)) range 1 len(r) len r mx = max(mx, (r[j] - mi)) mx max(mx, (r[j] - mi)) max mx r[j] - mi r[j] r j mi mi = min(mi, r[j]) mi min(mi, r[j]) min mi r[j] r j print(mx) print mx mi = min(mi, r[j]) min(mi, r[j]) mi mi = r[0] r[0] mi mx = -1e10 -1e10 mx n = int(input()) int(input()) n mx = max(mx, (r[j] - mi)) max(mx, (r[j] - mi)) mx r = [int(input()) for _ in range(n)] [int(input()) for _ in range(n)] r
n = int(input())
r = [int(input()) for _ in range(n)]

mi = r[0]
mx = -1e10
for j in range(1, len(r)):
    mx = max(mx, (r[j] - mi))
    mi = min(mi, r[j])
print(mx)