def maximum_profit(profit_minrate, rate):
    profit, minrate = profit_minrate
    return max(profit, rate-minrate), min(minrate, rate)

if __name__ == "__main__":
    R = [input() for _ in range(input())]
    print reduce(maximum_profit, R, (-float("inf"), float("inf")))[0] def maximum_profit(profit_minrate, rate):
    profit, minrate = profit_minrate
    return max(profit, rate-minrate), min(minrate, rate) maximum_profit profit, minrate = profit_minrate profit profit_minrate minrate return max(profit, rate-minrate), min(minrate, rate) return max(profit, rate-minrate), min(minrate, rate) max(profit, rate-minrate) max profit rate-minrate rate minrate min(minrate, rate) min minrate rate profit_minrate profit_minrate rate rate if __name__ == "__main__":
    R = [input() for _ in range(input())]
    print reduce(maximum_profit, R, (-float("inf"), float("inf")))[0] __name__ == "__main__" __name__ "__main__" input() for _ in range(input()) for _ in range(input()) _ range(input()) range input() input for _ in range(input()) input() input R = [input() for _ in range(input())] R [input() for _ in range(input())] print reduce(maximum_profit, R, (-float("inf"), float("inf")))[0] (maximum_profit, R, (-float("inf"), float("inf"))) reduce maximum_profit R (-float("inf"), float("inf")) -float("inf") float("inf") float "inf" float("inf") float "inf" 0 def maximum_profit(profit_minrate, rate):
    profit, minrate = profit_minrate
    return max(profit, rate-minrate), min(minrate, rate) def maximum_profit(profit_minrate, rate):
    profit, minrate = profit_minrate
    return max(profit, rate-minrate), min(minrate, rate) maximum_profit R = [input() for _ in range(input())] [input() for _ in range(input())] R
def maximum_profit(profit_minrate, rate):
    profit, minrate = profit_minrate
    return max(profit, rate-minrate), min(minrate, rate)

if __name__ == "__main__":
    R = [input() for _ in range(input())]
    print reduce(maximum_profit, R, (-float("inf"), float("inf")))[0]