N = int(raw_input())
nums = []

for i in range(N):
    nums.append(int(raw_input()))

m = -1000000000000000000000000
minvalue = nums[0]

for i in range(1, len(nums)):
    minvalue = min(minvalue, nums[i-1])
    value = nums[i] - minvalue
    if m <= value:
        m = value

print(m) N = int(raw_input()) N int(raw_input()) int raw_input() raw_input nums = [] nums [] for i in range(N):
    nums.append(int(raw_input())) i range(N) range N nums.append(int(raw_input())) nums.append nums append int(raw_input()) int raw_input() raw_input m = -1000000000000000000000000 m -1000000000000000000000000 minvalue = nums[0] minvalue nums[0] nums 0 for i in range(1, len(nums)):
    minvalue = min(minvalue, nums[i-1])
    value = nums[i] - minvalue
    if m <= value:
        m = value i range(1, len(nums)) range 1 len(nums) len nums minvalue = min(minvalue, nums[i-1]) minvalue min(minvalue, nums[i-1]) min minvalue nums[i-1] nums i-1 i 1 value = nums[i] - minvalue value nums[i] - minvalue nums[i] nums i minvalue if m <= value:
        m = value m <= value m value m = value m value print(m) print m N = int(raw_input()) int(raw_input()) N minvalue = min(minvalue, nums[i-1]) min(minvalue, nums[i-1]) minvalue value = nums[i] - minvalue nums[i] - minvalue value m = -1000000000000000000000000 -1000000000000000000000000 m minvalue = nums[0] nums[0] minvalue nums = [] [] nums m = value value m
N = int(raw_input())
nums = []

for i in range(N):
    nums.append(int(raw_input()))

m = -1000000000000000000000000
minvalue = nums[0]

for i in range(1, len(nums)):
    minvalue = min(minvalue, nums[i-1])
    value = nums[i] - minvalue
    if m <= value:
        m = value

print(m)