import java.io.*;
import java.util.*;
import java.lang.*;

public class Main
{
    public static void main(String args[])
    {
        BufferedReader inn= new BufferedReader(new InputStreamReader(System.in));
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int odd=0;
        int even=0;
        
        for(int i=1;i<=n/2;i++)
        {
            int temp=sc.nextInt();
            odd+= Math.abs(temp-i*2+1);
            even+=Math.abs(temp-2*i);
        }
        
        int ans=Math.min(odd, even);
        System.out.println(ans);
        
    }
}