An array of positive integers is given. Find the minimum number of operations required to transform the array into an arithmetic progression with a difference of .
In one operation, you are allowed to increase any element of the array by .
The first line contains a single integer n~(n \le 10^6).
The second line contains positive integers, each not exceeding 10^6.
Print the minimum number of operations required to transform the array into an arithmetic progression with a difference of .
In the first test, the array should be transformed into:
To do this, we need
operations.
Example 1
Example 2