Mirko has developed his own video game. The game has
To overcome this problem, Mirko has decided to reduce the number of points for certain levels with the goal of making the point sequence strictly increasing (so in the end easier levels are worth less points than the difficult ones).
Help Mirko fix his video game in such a way that the total number of points reduced is minimal. Final points have to be positive. You can assume that a solution exists for each test case.
Input Specification
The first line of input contains one positive integer
The next
Output Specification
The first and only line of output should contain one number - the minimum total number of points Mirko has to subtract to fulfill requirements given in the task statement above.
Sample Input 1
3
5
5
5
Sample Output 1
3
Sample Input 2
4
5
3
7
5
Sample Output 2
6
Comments