
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.Stack;

import javax.swing.JOptionPane;

public class Main {

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

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		int m[] = new int[(N/2)+1];
		
		int m2[] = new int[(N/2)+1];

		int t[] = new int[N+1];

		int sum1 = 0, sum2 = 0;

		for (int i = 1; i <= (N / 2); i++) {

			int a = sc.nextInt();

			m[i] = a;
			

		}

		Arrays.sort(m);
		
		for(int i=1;i<=(N/2);i++) {
			
			m2[i]=m[i];
		}
		
		for (int i = 1; i <= (N / 2); i++) {

			if (m[i] % 2 == 1) {

				if (t[m[i]] == 0) {

					if(m[i]<N-1)
						t[m[i]]++;
					continue;

				} else {

					
					if(m[i]>N) {
						
						sum1=10000;
						break;
						
					}
					
					while (t[m[i]] != 0) {

						m[i] += 2;

						sum1 += 2;
						
						if(m[i]>N) {
							
							sum1=10000;
							break;
							
						}

					}
					if(m[i]<N) 
					t[m[i]]++;
				}

			}

			else {

				if (m[i] - 1<N&&t[m[i] - 1] == 0) {

					sum1++;
					t[m[i] - 1]++;

				} else {

					m[i]++;
					sum1++;
					
					if(m[i]>N) {
						
						sum1=10000;
						break;
						
					}
					
					while (t[m[i]] != 0) {

						m[i] += 2;
						sum1 += 2;
						
						if(m[i]>N) {
							
							sum1=10000;
							break;
							
						}

					}
					
					if(m[i]<N) 
					t[m[i]]++;

				}

			}

		}////////////////홀수
		
		t=new int[N+1];
		t[0]=1;
		
		for (int i = 1; i <= (N / 2); i++) {

			if (m2[i] % 2 == 0) {

				if (t[m2[i]] == 0) {
					
					if(m2[i]<N-1)
					t[m2[i]]++;
					continue;

				} else {

					while (m2[i]-2<N&&t[m2[i]] != 0) {

						m2[i] += 2;

						sum2 += 2;

					}
					if(m2[i]<N) 
					t[m2[i]]++;
				}

			}

			else {

				if (t[m2[i] - 1] == 0) {

					sum2++;
					t[m2[i] - 1]++;

				} else {

					m2[i]++;
					sum2++;

					while (m2[i]-2<N&&t[m2[i]] != 0) {

						m2[i] += 2;
						sum2 += 2;

					}
					if(m2[i]<N) 
					t[m2[i]]++;

				}

			}

		}
		
		if(sum1>sum2) {
			
			System.out.println(sum2);
			
		}
		else {
			System.out.println(sum1);
			
		}

	}

}
