10777: 股票买卖

Memory Limit:64 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:2 Solved:0

Description

小明通过某公司股票规律,推算出这家公司每天的股价,为了防止别人发现他的秘密。他决定对于这家公司的股票最多买一次,现已将股票价格列了出来。从股票价格表上,算出每股股票最多的盈利。

Input

第一行一个n,表示n天(小于100000)
第二行 给出n天每股的价格

Output

每股最多赚多少钱

Sample Input Copy

4
947 267 359 771
7
669 735 322 794 397 565 181

Sample Output Copy

504
472