n = int(input())
min_value = 10**10
result = -(10**10)

for _ in [0]*n:
    current = int(input())
    result = max(result, current-min_value)
    min_value = min(min_value, current)

print(result) n = int(input()) n int(input()) int input() input min_value = 10**10 min_value 10**10 10 10 result = -(10**10) result -(10**10) 10**10 10 10 for _ in [0]*n:
    current = int(input())
    result = max(result, current-min_value)
    min_value = min(min_value, current) _ [0]*n [0] 0 n current = int(input()) current int(input()) int input() input result = max(result, current-min_value) result max(result, current-min_value) max result current-min_value current min_value min_value = min(min_value, current) min_value min(min_value, current) min min_value current print(result) print result min_value = min(min_value, current) min(min_value, current) min_value result = max(result, current-min_value) max(result, current-min_value) result n = int(input()) int(input()) n current = int(input()) int(input()) current min_value = 10**10 10**10 min_value result = -(10**10) -(10**10) result
n = int(input())
min_value = 10**10
result = -(10**10)

for _ in [0]*n:
    current = int(input())
    result = max(result, current-min_value)
    min_value = min(min_value, current)

print(result)
