q=int(input())
s=input().split()
b1=1
b2=2
a1=0
a2=0
for r in range(q//2):
    l1=b1-int(s[r])
    l2=b2-int(s[r])
    if l1*-1>l1:
        l1=l1*-1
    a1=a1+l1
    b1=b1+2
    if l2*-1>l2:
        l2=l2*-1
    a2=a2+l2
    b2=b2+2
if a1<a2:
    print(a1)
else:
    print(a2)