
n = int(input())

dif_max = - 10 ** 10
min_v = 10 ** 10

for i in range(n):
    r = int(input())
    dif_max = max(dif_max, r - min_v)
    min_v = min(min_v, r)

print(dif_max) n = int(input()) n int(input()) int input() input dif_max = - 10 ** 10 dif_max - 10 ** 10 - 10 10 min_v = 10 ** 10 min_v 10 ** 10 10 10 for i in range(n):
    r = int(input())
    dif_max = max(dif_max, r - min_v)
    min_v = min(min_v, r) i range(n) range n r = int(input()) r int(input()) int input() input dif_max = max(dif_max, r - min_v) dif_max max(dif_max, r - min_v) max dif_max r - min_v r min_v min_v = min(min_v, r) min_v min(min_v, r) min min_v r print(dif_max) print dif_max n = int(input()) int(input()) n dif_max = - 10 ** 10 - 10 ** 10 dif_max min_v = 10 ** 10 10 ** 10 min_v dif_max = max(dif_max, r - min_v) max(dif_max, r - min_v) dif_max r = int(input()) int(input()) r min_v = min(min_v, r) min(min_v, r) min_v

n = int(input())

dif_max = - 10 ** 10
min_v = 10 ** 10

for i in range(n):
    r = int(input())
    dif_max = max(dif_max, r - min_v)
    min_v = min(min_v, r)

print(dif_max)