AtCoder Beginner Contest 132
C
Divide the Problems
AtCoder
⌀ 0
原题
← BD →
翻译中…

Problem Statement

翻译中…

Takahashi made $N$ problems for competitive programming. The problems are numbered $1$ to $N$, and the difficulty of Problem $i$ is represented as an integer $d_i$ (the higher, the harder).

翻译中…

He is dividing the problems into two categories by choosing an integer $K$, as follows:

翻译中…
  • A problem with difficulty $K$ or higher will be for ARCs.
  • A problem with difficulty lower than $K$ will be for ABCs.
翻译中…

How many choices of the integer $K$ make the number of problems for ARCs and the number of problems for ABCs the same?

翻译中…

Problem Statement

翻译中…
  • $2 \leq N \leq 10^5$
  • $N$ is an even number.
  • $1 \leq d_i \leq 10^5$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
d_1 d_2 ... d_N

翻译中…

Output

翻译中…

Print the number of choices of the integer $K$ that make the number of problems for ARCs and the number of problems for ABCs the same.

翻译中…

样例

Input #1
6
9 1 4 4 6 7
Output #1
2
If we choose $K=5$ or $6$, Problem $1$, $5$, and $6$ will be for ARCs, Problem $2$, $3$, and $4$ will be for ABCs, and the objective is achieved. Thus, the answer is $2$.
Input #2
8
9 1 14 5 5 4 4 14
Output #2
0
There may be no choice of the integer $K$ that make the number of problems for ARCs and the number of problems for ABCs the same.
Input #3
14
99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1
Output #3
42685
题目信息
题号
abc132_c
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。