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


public class test {
    static boolean DEBUG_FLAG = false;
    int INF = (int)1e9;
    long MOD = 1000000007;
    
    static void debug(String s) {
        if(DEBUG_FLAG) {
            System.out.print(s);
        }
    }
    
    
    void solve(InputReader in, PrintWriter out) throws IOException {
        int n = in.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for(int i=0; i<n/2; i++) {
            int x = in.nextInt()-1;
            a[x] = 1;
            b[x] = 1;
        }
        int x = 0;
        for(int i=0; i<n; i++) {
            if(i%2==1) {
                if(a[i]==0) continue;
                int s = 1;
                int min = INF;
                int j =0;
                for(j=i-1; j>=0; j-=2) {
                    if(a[j]==0) {
                        break;
                    }
                    s+=2;
                }
                int jj = j;
                if(j>=0) min = s;
                s = 1;
                for(j=i+1; j<n; j+=2) {
                    if(a[j]==0) {
                        break;
                    }
                    s+=2;
                }
                if(j>=n) s = INF;
                if(s < min) {
                    a[j] = 1;
                    min = s;
                } else if(min < s) {
                    a[jj] = 1;
                } else if(min==s && s!=INF) {
                    a[jj] = 1;
                } else {
                    continue;
                }
                a[i] = 0;
                x += min;
            }
        }
        int y = 0;
        for(int i=0; i<n; i++) {
            if(i%2==0) {
                if(b[i]==0) continue;
                int s = 1;
                int min = INF;
                int j =0;
                for(j=i-1; j>=0; j-=2) {
                    if(b[j]==0) {
                        break;
                    }
                    s+=2;
                }
                int jj = j;
                if(j>=0) min = s;
                s = 1;
                for(j=i+1; j<n; j+=2) {
                    if(b[j]==0) {
                        break;
                    }
                    s+=2;
                }
                if(j>=n) s = INF;
                if(s < min) {
                    b[j] = 1;
                    min = s;
                } else if(min < s) {
                    b[jj] = 1;
                } else if(min==s && s!=INF) {
                    b[jj] = 1;
                } else {
                    continue;
                }
                b[i] = 0;
                y += min;
            }
        }
//        out.println(Arrays.toString(a));
//        out.println(Arrays.toString(b));
        out.println(Math.min(x, y));
    }
    
    
    public static void main(String[] args) throws IOException {
        if(args.length>0 && args[0].equalsIgnoreCase("d")) {
            DEBUG_FLAG = true;
        }
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;//in.nextInt();
        long start = System.nanoTime();
        while(t-- >0) {
            new test().solve(in, out);
        }
        long end = System.nanoTime();
        debug("\nTime: " + (end-start)/1e6 + " \n\n");
        out.close();
    }
    
    static class InputReader {
        static BufferedReader br;
        static StringTokenizer st;
    
        public InputReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        
        String next() {
            while (st == null || !st.hasMoreTokens()) {
                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());
        }
    }
}