from sys import stdin, stdout
length = int(stdin.readline().rstrip())
pos = [int(x) for x in stdin.readline().rstrip().split()]
num = length/2

center = 0
for p in pos:
	center += p
center /= length/2
lf = center - num
rt = center + num
if lf < 1:
	offset = 1 - lf
elif rt > 100:
	offset = 100 - rt
moves = 0
targetPos = range(lf+offset, rt+offset, 2)
for index in range(len(targetPos)):
	moves += abs(pos[index]-targetPos[index]+offset)
print moves
