Sonya was unable to think of a story for this problem, so here comes the formal description.

You are given the array containing n positive integers. At one turn you can pick any element and increase or decrease it by 1. The goal is the make the array strictly increasing by making the minimum possible number of operations. You are allowed to change elements in any way, they can become negative or equal to 0.


-----Input-----

The first line of the input contains a single integer n (1 ≤ n ≤ 3000) — the length of the array.

Next line contains n integer a_{i} (1 ≤ a_{i} ≤ 10^9).


-----Output-----

Print the minimum number of operation required to make the array strictly increasing.


-----Examples-----
Input
7
2 1 5 11 5 9 11

Output
9

Input
5
5 4 3 2 1

Output
12



-----Note-----

In the first sample, the array is going to look as follows:

2 3 5 6 7 9 11

|2 - 2| + |1 - 3| + |5 - 5| + |11 - 6| + |5 - 7| + |9 - 9| + |11 - 11| = 9

And for the second sample:

1 2 3 4 5

|5 - 1| + |4 - 2| + |3 - 3| + |2 - 4| + |1 - 5| = 12

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'from bisect import insort\nclass Graph:\n    def __init__(_):\n        _.change = [-10**27] # increment slope at ...\n        _.a = _.y = 0 # last line has slope a, starts from y\n        _.dx = 0      # the whole graph is shifted right by ...\n    def __repr__(_): return f"<{[x+_.dx for x in _.change]}; {_.a} {_.y}>"\n    \n    def shiftx(_, v): _.dx+= v\n    def shifty(_, v): _.y+= v\n    def addleft(_, v):\n        if _.change[-1] < v-_.dx:\n            dx = v-_.dx - _.change[-1]\n            _.y+= _.a*dx\n        insort(_.change, v-_.dx)\n    def addright(_, v):\n        if _.change[-1] < v-_.dx:\n            dx = v-_.dx - _.change[-1]\n            _.y+= _.a*dx; _.a+= 1\n            insort(_.change, v-_.dx)\n            return\n        insort(_.change, v-_.dx)\n        _.a+= 1; _.y+= _.change[-1]-(v-_.dx)\n    #def remleft(_, v): change.remove(v-_.dx)\n    def cutright(_):\n        dx = _.change.pop()-_.change[-1]\n        _.a-= 1; _.y-= _.a*dx\n\nn = int(input())\nG = Graph()\nfor x in map(int,input().split()):\n    G.shiftx(1)\n    G.addleft(x)\n    G.addright(x)\n    while G.a > 0: G.cutright()\nprint(G.y)'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 16995