def bisect(l, r):

    while l < r:

        m = (l + r) // 2

        s1 = sum(abs(am - m) for am in aam)

        s2 = sum(abs(am - m - 1) for am in aam)

        if s1 < s2:

            r = m

        else:

            l = m + 1

    return l





n = int(eval(input()))

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

aam = [a - i - 1 for i, a in enumerate(aaa)]

aas = sum(aam)

b = bisect(int(-1e9), int(1e9))

print((sum(abs(am - b) for am in aam)))

n = int(eval(input()))

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

aam = [a - i - 1 for i, a in enumerate(aaa)]

aam.sort()

b = aam[n // 2]

print((sum(abs(am - b) for am in aam)))

def bisect(l, r):
    while l < r:
        m = (l + r) // 2
        s1 = sum(abs(am - m) for am in aam)
        s2 = sum(abs(am - m - 1) for am in aam)
        if s1 < s2:
            r = m
        else:
            l = m + 1
    return l


n = int(eval(input()))
aaa = list(map(int, input().split()))
aam = [a - i - 1 for i, a in enumerate(aaa)]
aas = sum(aam)
b = bisect(int(-1e9), int(1e9))
print((sum(abs(am - b) for am in aam)))

n = int(eval(input()))
aaa = list(map(int, input().split()))
aam = [a - i - 1 for i, a in enumerate(aaa)]
aam.sort()
b = aam[n // 2]
print((sum(abs(am - b) for am in aam)))

-def bisect(l, r): -    while l < r: -        m = (l + r) // 2 -        s1 = sum(abs(am - m) for am in aam) -        s2 = sum(abs(am - m - 1) for am in aam) -        if s1 < s2: -            r = m -        else: -            l = m + 1 -    return l - - -aas = sum(aam) -b = bisect(int(-1e9), int(1e9)) +aam.sort() +b = aam[n // 2]