# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
if A == []:
return 0
cost = [0] * (len(A)-1)
for i in range(len(A)-1):
cost[i] = A[i+1] - A[i]
s = 0
maxS = 0
for c in cost:
if s > 0:
s += c
else:
s = c
if s > maxS:
maxS = s
return max(maxS, 0)