//*******************************************************************
// Welcome to CompileJava!
// If you experience any issues, please contact us ('More Info')  -->
// Also, sorry that the "Paste" feature no longer works! GitHub broke
// this (so we'll switch to a new provider): https://blog.github.com\
// /2018-02-18-deprecation-notice-removing-anonymous-gist-creation/
//*******************************************************************

import java.util.*;// headers MUST be above the first class

// one class needs to have a main() method
public class PS985A
{
  // arguments are passed using the text field below this editor
  public static void main(String[] args)
  {
   Scanner s= new Scanner(System.in);
    int n= s.nextInt();
    int[] pos= new int[n];
    for (int i=0; i<n/2; i++) pos[i]= s.nextInt();
    
    int max1=0; int max2=0;
    for (int i=0; i<n/2; i++)
    {
      max1+= Math.abs(pos[i]-(i*2+1));
      max2+= Math.abs(pos[i]-(i*2+2));
    }
    System.out.println(Math.max(max1,max2));
  }
}