import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Collections;
import java.util.LinkedList;
import java.util.StringTokenizer;

public class Main {

	static LinkedList<Integer> list = new LinkedList<>();

	static int Answer;
	static int N;

	public static void main(String args[]) throws Exception	{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		N = Integer.parseInt(br.readLine());
		StringTokenizer st = new StringTokenizer(br.readLine(), " ");

		while(st.hasMoreTokens())
			list.add(Integer.parseInt(st.nextToken()));
		Collections.sort(list);

		int start = list.get(0);
		for(int i = 1; i < list.size(); i++) {

			Answer += Math.abs((start + 2) - list.get(i));

			if(Math.abs((start + 2) - list.get(i)) > N) {

				Answer = Integer.MAX_VALUE;
				break;
			}

			start += 2;
		}

		int Answer2 = Math.abs(list.get(0) - 2);
		start = 2;
		for(int i = 1; i < list.size(); i++) {

			Answer2 += Math.abs((start + 2) - list.get(i));

			if(Math.abs((start + 2) - list.get(i)) > N) {

				Answer2 = Integer.MAX_VALUE;
				break;
			}

			start += 2;
		}
		System.out.println(Math.min(Answer, Answer2));

		br.close();
	}
}