// Marcelino Galarza
// May 21st, 2018

import java.util.Arrays;
import java.util.Scanner;

public class a 
{

	public static void main(String args[])
	{
		Scanner in = new Scanner(System.in);
		int size = in.nextInt();
		boolean arr[] = new boolean[size];
		boolean odd[] = new boolean[size];
		boolean even[] = new boolean[size];
		int indexs[] = new int[size/2];
		for (int i = 0; i < size/2; i++)
		{
			int index = in.nextInt()-1;
			arr[index] = true;
			odd[index] = true;
			even[index] = true;
			indexs[i] = index;
		} 
		
		Arrays.sort(indexs);
		
		// Just brute force even and odd
		// try even index first
		
		
		// This is for ODD
		int oddCount = 0;
		
		// force the leftmost spot 
		if (!odd[0])
		{
			oddCount += indexs[0];
			
			// Order here matters, might overwrite
			odd[indexs[0]] = false;
			odd[0] = true;
		}
		
		// index 'i' is odd spots where we should be placeing
		for (int i = 2; i < odd.length; i+=2)
		{
//			System.out.println("Count before = " + oddCount);
//			for (boolean x : odd)
//			{
//				if (x)
//					System.out.print(1 + " ");
//				else
//					System.out.print(0 + " ");
//			}
//			System.out.println();
			
			if (odd[i-1])
			{
				int total = 0;
				for (int m = i; m < odd.length; m++)
				{
					if (!odd[m])
						break;
					total++;
				}
				
				odd[i-1] = false;
				odd[i+total] = true;
				oddCount += total+1;
			}
			else if (odd[i])
				continue;
			else
			{
				odd[indexs[i/2]] = false;
				odd[i] = true;
				oddCount += indexs[i/2] - i;
			}
//			System.out.println("Count after = " + oddCount + "\n");
		}
		
		
		
		
		
		
		

		// Now lets do it for evens :)
		// I HATE THIS PROBLEM (:
		
		
		
		// This is for EVEN
		int evenCount = 0;
		
		// force the rightmost spot 
		if (!even[size-1])
		{
			evenCount += (size - 1 - indexs[size/2-1]);
			
			// Oder here matters too
			even[indexs[size/2-1]] = false;
			even[size-1] = true;
		}
		
		// index 'i' is odd spots where we should be placeing
		for (int i = size-3; i >= 0; i-=2)
		{
//			System.out.println("Count before = " + evenCount);
//			for (boolean x : even)
//			{
//				if (x)
//					System.out.print(1 + " ");
//				else
//					System.out.print(0 + " ");
//			}
//			System.out.println();
			
			if (even[i+1])
			{
				int total = 0;
				for (int m = i; m >= 0; m--)
				{
					if (!even[m])
						break;
					total++;
				}
				
				even[i+1] = false;
				//System.out.println("i = " + i + " total = " + total + " i - total = " + (i-total));
				even[i-total] = true;
				evenCount += total+1;
			}
			else if (even[i])
				continue;
			else
			{
				even[indexs[i/2]] = false;
				even[i] = true;
				//System.out.println("i = " + i + " i/2 = " + (i/2) + " indexs[i/2] = " + indexs[i/2]);
				evenCount += i - indexs[i/2];
			}
			//System.out.println("Count after = " + evenCount + "\n");
		}
	
//		System.out.print("ODD: ");
//		for (boolean x : odd)
//		{
//			if (x)
//				System.out.print(1 + " ");
//			else
//				System.out.print(0 + " ");
//		}
//		System.out.print("\nEVEN: ");
//		for (boolean x : even)
//		{
//			if (x)
//				System.out.print(1 + " ");
//			else
//				System.out.print(0 + " ");
//		}
//		
//		System.out.println("\noddCount = " + oddCount + "  evenCount = " + evenCount);
		System.out.println(Math.min(oddCount, evenCount));
		
		in.close();
	}
}
