import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class JavaApplication7 {
    public static void main(String[] args) {
        FastReader read = new FastReader();
        int n = read.nextInt();
        int array[] = new int[n/2];
        long sum1 = 0;
        long sum2 = 0;
        int count = 1;
        for(int i = 0; i<n/2; i++){
            int t = read.nextInt();
            sum1+= (Math.abs(count-t));
            count++;
            sum2+=(Math.abs(count-t));
            count++;
        }
        System.out.println(Math.min(sum1,sum2));
    }
        static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    }  
    } 
    
