N, *A = map(int, open(0).read().split()) x = list(range(1, N // 2 + 1)) + [(N + 1) // 2] + list(range(N // 2, 1 - 1, -1)) a = 0 b = 0 for i in range(N): t = A[i] - x[i] if t < 0: a += -t elif t > 0: b += t print(b)