N = int(eval(input()))

A = [int(i) for i in input().split()]

A = [A[_] - (_ + 1) for _ in range(N)]

AA = sorted(A)

ans = 0

ans1 = 0

center = N // 2

num = AA[center]



if N % 2 != 0:

    for i in range(N):

        ans += abs(AA[i] - num)

    print(ans)

else:

    center = len(AA) // 2

    for i in range(N):

        ans += abs(AA[i]- num)

        ans1 += abs(AA[i]-(AA[center-1]))

    print((min(ans, ans1)))
N = int(eval(input()))

A = [int(i) for i in input().split()]

for i in range(N):

    A[i] -= (i+1)



A.sort()



if N % 2 != 0:

    num = A[N//2]

    A = [abs(i - num) for i in A]

    print((sum(A)))

else:

    num1 = A[N//2]

    num2 = num1 -1

    A1 = [abs(i - num1) for i in A]

    A2 = [abs(i - num2) for i in A]

    print((min(sum(A1), sum(A2))))
N = int(eval(input()))
A = [int(i) for i in input().split()]
A = [A[_] - (_ + 1) for _ in range(N)]
AA = sorted(A)
ans = 0
ans1 = 0
center = N // 2
num = AA[center]
if N % 2 != 0:
    for i in range(N):
        ans += abs(AA[i] - num)
    print(ans)
else:
    center = len(AA) // 2
    for i in range(N):
        ans += abs(AA[i] - num)
        ans1 += abs(AA[i] - (AA[center - 1]))
    print((min(ans, ans1)))

N = int(eval(input()))
A = [int(i) for i in input().split()]
for i in range(N):
    A[i] -= i + 1
A.sort()
if N % 2 != 0:
    num = A[N // 2]
    A = [abs(i - num) for i in A]
    print((sum(A)))
else:
    num1 = A[N // 2]
    num2 = num1 - 1
    A1 = [abs(i - num1) for i in A]
    A2 = [abs(i - num2) for i in A]
    print((min(sum(A1), sum(A2))))

-A = [A[_] - (_ + 1) for _ in range(N)] -AA = sorted(A) -ans = 0 -ans1 = 0 -center = N // 2 -num = AA[center] +for i in range(N): +    A[i] -= i + 1 +A.sort() -    for i in range(N): -        ans += abs(AA[i] - num) -    print(ans) +    num = A[N // 2] +    A = [abs(i - num) for i in A] +    print((sum(A))) -    center = len(AA) // 2 -    for i in range(N): -        ans += abs(AA[i] - num) -        ans1 += abs(AA[i] - (AA[center - 1])) -    print((min(ans, ans1))) +    num1 = A[N // 2] +    num2 = num1 - 1 +    A1 = [abs(i - num1) for i in A] +    A2 = [abs(i - num2) for i in A] +    print((min(sum(A1), sum(A2))))