import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        Arrays.sort(array);
        // 中央の要素の小さい側 + 1
        int idx = n / 2 - 1;
        int center = array[idx] + 1;
        idx++;
        int cnt = 0;
        while (true) {
            if (array[idx] >= center) {
                cnt++;
            } else {
                break;
            }
            center++;
        }
        System.out.println(cnt);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        Arrays.sort(array);
        // 中央の要素の小さい側 + 1
        int idx = n / 2 - 1;
        int center = array[idx] + 1;
        idx++;
        int cnt = 0;
        while (true) {
            if (array[idx] >= center) {
                cnt++;
            } else {
                break;
            }
            center++;
        }
        System.out.println(cnt);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        Arrays.sort(array);
        // 中央の要素の小さい側 + 1
        int idx = n / 2 - 1;
        int center = array[idx] + 1;
        idx++;
        int cnt = 0;
        while (true) {
            if (array[idx] >= center) {
                cnt++;
            } else {
                break;
            }
            center++;
        }
        System.out.println(cnt);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        Arrays.sort(array);
        // 中央の要素の小さい側 + 1
        int idx = n / 2 - 1;
        int center = array[idx] + 1;
        idx++;
        int cnt = 0;
        while (true) {
            if (array[idx] >= center) {
                cnt++;
            } else {
                break;
            }
            center++;
        }
        System.out.println(cnt);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] array = new int[n]; array new int[n] n for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            array[i] = sc.nextInt();
        } {
            array[i] = sc.nextInt();
        } array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc Arrays.sort(array) Arrays.sort Arrays array int idx = n / 2 - 1; idx n / 2 - 1 n / 2 n 2 1 int center = array[idx] + 1; center array[idx] + 1 array[idx] array idx 1 idx++ idx int cnt = 0; cnt 0 while (true) {
            if (array[idx] >= center) {
                cnt++;
            } else {
                break;
            }
            center++;
        } true {
            if (array[idx] >= center) {
                cnt++;
            } else {
                break;
            }
            center++;
        } if (array[idx] >= center) {
                cnt++;
            } else {
                break;
            } array[idx] >= center array[idx] array idx center {
                cnt++;
            } cnt++ cnt {
                break;
            } break; center++ center System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        Arrays.sort(array);
        // 中央の要素の小さい側 + 1
        int idx = n / 2 - 1;
        int center = array[idx] + 1;
        idx++;
        int cnt = 0;
        while (true) {
            if (array[idx] >= center) {
                cnt++;
            } else {
                break;
            }
            center++;
        }
        System.out.println(cnt);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        Arrays.sort(array);
        // 中央の要素の小さい側 + 1
        int idx = n / 2 - 1;
        int center = array[idx] + 1;
        idx++;
        int cnt = 0;
        while (true) {
            if (array[idx] >= center) {
                cnt++;
            } else {
                break;
            }
            center++;
        }
        System.out.println(cnt);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        Arrays.sort(array);
        // 中央の要素の小さい側 + 1
        int idx = n / 2 - 1;
        int center = array[idx] + 1;
        idx++;
        int cnt = 0;
        while (true) {
            if (array[idx] >= center) {
                cnt++;
            } else {
                break;
            }
            center++;
        }
        System.out.println(cnt);
    }
}
