# Stock Maximize

Execution time limit is 1 second

Runtime memory usage limit is 128 megabytes

Your algorithms have become so good at predicting the market that now you know what the share price of Wooden Orange Toothpicks Inc. (WOT) will be for the next number of days.

Each day, you can either buy one share of WOT, sell any number of shares of WOT that you own, or not make any transaction at all. What is the maximum profit you can obtain with the optimum trading strategy?

## Input

The first line contains the number of predicted prices $n(1≤n≤50000)$ for WOT. The next line contains $n$ integers $p_{i}(1≤p_{i}≤10_{5})$, each is a predicted stock price on the $i$-th day.

## Output

Print the maximum profit that can be obtained in the market.

## Examples

Input #1

Answer #1

Input #2

Answer #2

Submissions 199

Acceptance rate 49%