题目描述
Problem Description
Takahashi has created $ N $ problems for competitive programming. Each problem is numbered from $ 1 $ to $ N $, and the difficulty of problem $ i $ is represented by an integer $ d_i $ (higher values indicate greater difficulty).
Takahashi is trying to classify these problems into two types by choosing an integer $ K $:
- Problems with difficulty $ K $ or higher are for "ARC"
- Problems with difficulty below $ K $ are for "ABC"
How many ways are there to choose an integer $ K $ such that the number of problems for "ARC" and "ABC" are equal?
Input Format
The input is given from the standard input in the following format:
$ N $ $ d_1 $ $ d_2 $ $ ... $ $ d_N $
Output Format
Output the number of ways to choose an integer $ K $ such that the number of problems for "ARC" and "ABC" are equal.
Sample Input and Output
Sample Input #1
6
9 1 4 4 6 7
Sample Output #1
2
Sample Input #2
8
9 1 14 5 5 4 4 14
Sample Output #2
0
Sample Input #3
14
99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1
Sample Output #3
42685
Notes/Hints
Constraints
- $2 \leq N \leq 10^5$
- $ N $ is even.
- $1 \leq d_i \leq 10^5$
- All inputs are integers.
Sample Explanation 1
When $ K = 5, 6 $, problems $ 1, 5, 6 $ are for "ARC" and problems $ 2, 3, 4 $ are for "ABC", satisfying the condition. Therefore, the answer is $ 2 $ ways.
Sample Explanation 2
There may be cases where no choice of integer $ K $ can make the number of problems for "ARC" and "ABC" equal.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分