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

public class Main {
    int MAX = 100000;
    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ds = new int[MAX + 1];

        for (int i = 0; i < n; i++) {
            ds[sc.nextInt()]++;
        }
        n /= 2;
        int cnt = 0;
        for (int i = 1; i <= MAX; i++) {
            ds[i] += ds[i - 1];
            if (ds[i] == n) cnt++;
        }
//        debug(ds);
        System.out.println(cnt);
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    int MAX = 100000;
    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ds = new int[MAX + 1];

        for (int i = 0; i < n; i++) {
            ds[sc.nextInt()]++;
        }
        n /= 2;
        int cnt = 0;
        for (int i = 1; i <= MAX; i++) {
            ds[i] += ds[i - 1];
            if (ds[i] == n) cnt++;
        }
//        debug(ds);
        System.out.println(cnt);
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
} Main int MAX = 100000; MAX 100000 void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ds = new int[MAX + 1];

        for (int i = 0; i < n; i++) {
            ds[sc.nextInt()]++;
        }
        n /= 2;
        int cnt = 0;
        for (int i = 1; i <= MAX; i++) {
            ds[i] += ds[i - 1];
            if (ds[i] == n) cnt++;
        }
//        debug(ds);
        System.out.println(cnt);
    } run {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ds = new int[MAX + 1];

        for (int i = 0; i < n; i++) {
            ds[sc.nextInt()]++;
        }
        n /= 2;
        int cnt = 0;
        for (int i = 1; i <= MAX; i++) {
            ds[i] += ds[i - 1];
            if (ds[i] == n) cnt++;
        }
//        debug(ds);
        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[] ds = new int[MAX + 1]; ds new int[MAX + 1] MAX + 1 MAX 1 for (int i = 0; i < n; i++) {
            ds[sc.nextInt()]++;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            ds[sc.nextInt()]++;
        } {
            ds[sc.nextInt()]++;
        } ds[sc.nextInt()]++ ds[sc.nextInt()] ds sc.nextInt() sc.nextInt sc n /= 2 n 2 int cnt = 0; cnt 0 for (int i = 1; i <= MAX; i++) {
            ds[i] += ds[i - 1];
            if (ds[i] == n) cnt++;
        } int i = 1; int i = 1; i 1 i <= MAX i MAX i++ i++ i {
            ds[i] += ds[i - 1];
            if (ds[i] == n) cnt++;
        } {
            ds[i] += ds[i - 1];
            if (ds[i] == n) cnt++;
        } ds[i] += ds[i - 1] ds[i] ds i ds[i - 1] ds i - 1 i 1 if (ds[i] == n) cnt++; ds[i] == n ds[i] ds i n cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    } debug {
        System.err.println(Arrays.deepToString(os));
    } System.err.println(Arrays.deepToString(os)) System.err.println System.err System System.err Arrays.deepToString(os) Arrays.deepToString Arrays os Object... os os public static void main(String[] args) {
        new Main().run();
    } main {
        new Main().run();
    } new Main().run() new Main().run new Main() String[] args args public class Main {
    int MAX = 100000;
    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ds = new int[MAX + 1];

        for (int i = 0; i < n; i++) {
            ds[sc.nextInt()]++;
        }
        n /= 2;
        int cnt = 0;
        for (int i = 1; i <= MAX; i++) {
            ds[i] += ds[i - 1];
            if (ds[i] == n) cnt++;
        }
//        debug(ds);
        System.out.println(cnt);
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
} public class Main {
    int MAX = 100000;
    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ds = new int[MAX + 1];

        for (int i = 0; i < n; i++) {
            ds[sc.nextInt()]++;
        }
        n /= 2;
        int cnt = 0;
        for (int i = 1; i <= MAX; i++) {
            ds[i] += ds[i - 1];
            if (ds[i] == n) cnt++;
        }
//        debug(ds);
        System.out.println(cnt);
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
} Main

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

public class Main {
    int MAX = 100000;
    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ds = new int[MAX + 1];

        for (int i = 0; i < n; i++) {
            ds[sc.nextInt()]++;
        }
        n /= 2;
        int cnt = 0;
        for (int i = 1; i <= MAX; i++) {
            ds[i] += ds[i - 1];
            if (ds[i] == n) cnt++;
        }
//        debug(ds);
        System.out.println(cnt);
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}
