import java.io.BufferedReader;
import java.io.InputStreamReader;

public class ChessPlacing {
    public static void main(String[] args) throws Exception {
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String s = br.readLine();
            int n = Integer.parseInt(s);

            s = br.readLine();
            String[] tokens = s.split(" ");
            int evenCount = 0;
            int oddCount = 0;
            for (int i = 1; i <= tokens.length; i++) {
                int tmp = Integer.parseInt(tokens[i-1]);
                evenCount += Math.abs(tmp - 2 * i);
                oddCount += Math.abs(tmp - (2 * i - 1));
            }

            System.out.println(Math.min(evenCount, oddCount));
        }
    }
}
