You are given an array of prices, where pricesi contains the price of a stock on the i-th day.
Each day, you can decide whether to buy and/or sell stocks. At any given time, you can own at most one stock.
Find the maximum profit that can be obtained.
The first line contains the size n (n≤105) of the price array. The second line contains the price array - n integers, each not exceeding 104.
Print the maximum profit that can be obtained. If it is impossible to obtain a profit, output 0.