N = int(eval(input()))

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

B = sorted(A[i] - i - 1 for i in range(N))

def sad(b):

    return sum(abs(A[i] - i - 1 - b)for i in range(N))

print((min(sad(B[N//2]),sad(B[min(N//2+1,N-1)]))))

N=int(eval(input()))

B=sorted(int(x)-i-1 for i,x in enumerate(input().split()))

def sad(x):

    return sum(abs(b-x)for b in B)

print((sad(B[N//2])))

N = int(eval(input()))
A = list(map(int, input().split()))
B = sorted(A[i] - i - 1 for i in range(N))


def sad(b):
    return sum(abs(A[i] - i - 1 - b) for i in range(N))


print((min(sad(B[N // 2]), sad(B[min(N // 2 + 1, N - 1)]))))

N = int(eval(input()))
B = sorted(int(x) - i - 1 for i, x in enumerate(input().split()))


def sad(x):
    return sum(abs(b - x) for b in B)


print((sad(B[N // 2])))

-A = list(map(int, input().split())) -B = sorted(A[i] - i - 1 for i in range(N)) +B = sorted(int(x) - i - 1 for i, x in enumerate(input().split())) -def sad(b): -    return sum(abs(A[i] - i - 1 - b) for i in range(N)) +def sad(x): +    return sum(abs(b - x) for b in B) -print((min(sad(B[N // 2]), sad(B[min(N // 2 + 1, N - 1)])))) +print((sad(B[N // 2])))