// Arup Guha
// 5/10/2016
// Solution to USACO Gold December Problem: High Card Low Card (Gold)

import java.util.*;
import java.io.*;

public class cardgame {

	public static void main(String[] args) throws Exception {

		// Read in data.
		BufferedReader stdin = new BufferedReader(new FileReader("cardgame.in"));
		StringTokenizer tok = new StringTokenizer(stdin.readLine());
		int n = Integer.parseInt(tok.nextToken());
		int[] elsieLeft = new int[n/2];
		int[] elsieRight = new int[n/2];
		for (int i=0; i<n/2; i++)
			elsieLeft[i] = Integer.parseInt(stdin.readLine().trim());
		for (int i=0; i<n/2; i++)
			elsieRight[i] = Integer.parseInt(stdin.readLine().trim());

		// I use this to make bessie's list.
		int[] elsie = new int[n];
		for (int i=0; i<n/2; i++) elsie[i] = elsieLeft[i];
		for (int i=n/2; i<n; i++) elsie[i] = elsieRight[i-n/2];

		// Sort both.
		Arrays.sort(elsieLeft);
		Arrays.sort(elsieRight);
		Arrays.sort(elsie);

		// Now, create Elsie's card list.
		int[] bessie = new int[n];
		int iElsie = 0, iBessie = 0;
		for (int cur=1; cur<=2*n; cur++) {
			if (iBessie == n) break;
			if (iElsie < n && elsie[iElsie] == cur) iElsie++;
			else bessie[iBessie++] = cur;
		}

		// We sort this also.
		Arrays.sort(bessie);

		int res = 0;
		iBessie = n/2;

		// Step through Elsie's array, from smallest to largest.
		// Do a greedy here to maximize wins in this section, with these set of high cards.
		for (int i=0; i<n/2; i++) {
			while (iBessie<n && bessie[iBessie] < elsieLeft[i]) iBessie++;
			if (iBessie < n) {
				res++;
				iBessie++;
			}
		}

		// Now, go through Elsie's right array from smallest to largest.
		// Do a greedy here to maximize wins in this section, with these set of low cards.
		iBessie = n/2-1;
		for (int i=n/2-1; i>=0; i--) {
			while (iBessie>=0 && bessie[iBessie] > elsieRight[i]) iBessie--;
			if (iBessie >= 0) System.out.println(i+" "+iBessie+" "+bessie[iBessie]+" "+elsieRight[i]);
			if (iBessie >= 0) {
				res++;
				iBessie--;
			}
		}

		// Write result.
		PrintWriter out = new PrintWriter(new FileWriter("cardgame.out"));
		out.println(res);
		out.close();
		stdin.close();
	}
}