n = int(eval(input()))

a = list(map(int, input().split()))





def sadness(b):

  sad = 0

  for i, e in enumerate(a):

    i += 1

    sad += abs(e - (b + i))

  return sad





left, right = -10**9, 10**9 + 1

while right - left > 1:

  mid = (left + right) // 2



  if sadness(mid) > sadness(mid + 1):

    left = mid

  else:

    right = mid



# for b in range(-20, 20):

#   print(b,sadness(b))



print((min(sadness(left), sadness(right))))

n = int(eval(input()))

a = list(map(int, input().split()))





def sadness(b):

  sad = 0

  for i, e in enumerate(a):

    i += 1

    sad += abs(e - (b + i))

  return sad





d = []

for i, e in enumerate(a):

  i += 1

  d.append(e - i)



d.sort()



if len(d) % 2 == 1:

  print((sadness(d[len(d) // 2])))

else:

  print((min(sadness(d[len(d) // 2]), sadness(d[len(d) // 2 + 1]))))

n = int(eval(input()))
a = list(map(int, input().split()))


def sadness(b):
    sad = 0
    for i, e in enumerate(a):
        i += 1
        sad += abs(e - (b + i))
    return sad


left, right = -(10**9), 10**9 + 1
while right - left > 1:
    mid = (left + right) // 2
    if sadness(mid) > sadness(mid + 1):
        left = mid
    else:
        right = mid
# for b in range(-20, 20):
#   print(b,sadness(b))
print((min(sadness(left), sadness(right))))

n = int(eval(input()))
a = list(map(int, input().split()))


def sadness(b):
    sad = 0
    for i, e in enumerate(a):
        i += 1
        sad += abs(e - (b + i))
    return sad


d = []
for i, e in enumerate(a):
    i += 1
    d.append(e - i)
d.sort()
if len(d) % 2 == 1:
    print((sadness(d[len(d) // 2])))
else:
    print((min(sadness(d[len(d) // 2]), sadness(d[len(d) // 2 + 1]))))

-left, right = -(10**9), 10**9 + 1 -while right - left > 1: -    mid = (left + right) // 2 -    if sadness(mid) > sadness(mid + 1): -        left = mid -    else: -        right = mid -# for b in range(-20, 20): -#   print(b,sadness(b)) -print((min(sadness(left), sadness(right)))) +d = [] +for i, e in enumerate(a): +    i += 1 +    d.append(e - i) +d.sort() +if len(d) % 2 == 1: +    print((sadness(d[len(d) // 2]))) +else: +    print((min(sadness(d[len(d) // 2]), sadness(d[len(d) // 2 + 1]))))