问题 C:中位数

文件提交:无需freopen 内存限制:128 MB 时间限制:1.000 S
评测方式:普通裁判 命题人:
提交:6 解决:3

题目描述

中位数,就指将所有数字排序后,位置在最中间的数。

给定 lns="http://www.w3.org/1998/Math/MathML"> 个数字的序列 lns="http://www.w3.org/1998/Math/MathML">1,2,...,,以及一个期望中位数 lns="http://www.w3.org/1998/Math/MathML">。小爱想知道,最少再添加多少个数字,才能使序列中包含奇数个数字,且 lns="http://www.w3.org/1998/Math/MathML"> 为该序列的中位数?

输入

输入共三行:( , lns="http://www.w3.org/1998/Math/MathML">109,109
第一行,一个正整数 lns="http://www.w3.org/1998/Math/MathML"> ,表示元素个数
第二行,lns="http://www.w3.org/1998/Math/MathML"> 个整数,分别表示 lns="http://www.w3.org/1998/Math/MathML">1,2,...,
第三行,一个整数 lns="http://www.w3.org/1998/Math/MathML"> ,表示期望中位数

输出

输入一个整数,表示答案

样例输入-1 复制

4
6 4 7 1
3

样例输出-1 复制

3

提示

样例解释:加1个3 和 2个1,就可以让3成为中位数