CF768A.Oath of the Night's Watch

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

"Night gathers, and now my watch begins. It shall not end until my death. I shall take no wife, hold no lands, father no children. I shall wear no crowns and win no glory. I shall live and die at my post. I am the sword in the darkness. I am the watcher on the walls. I am the shield that guards the realms of men. I pledge my life and honor to the Night's Watch, for this night and all the nights to come." — The Night's Watch oath.

With that begins the watch of Jon Snow. He is assigned the task to support the stewards.

This time he has nn stewards with him whom he has to provide support. Each steward has his own strength. Jon Snow likes to support a steward only if there exists at least one steward who has strength strictly less than him and at least one steward who has strength strictly greater than him.

Can you find how many stewards will Jon support?

输入格式

First line consists of a single integer nn ( 1<=n<=1051<=n<=10^{5} ) — the number of stewards with Jon Snow.

Second line consists of nn space separated integers a1,a2,...,ana_{1},a_{2},...,a_{n} ( 0<=ai<=1090<=a_{i}<=10^{9} ) representing the values assigned to the stewards.

输出格式

Output a single integer representing the number of stewards which Jon will feed.

输入输出样例

  • 输入#1

    2
    1 5
    

    输出#1

    0
  • 输入#2

    3
    1 2 5
    

    输出#2

    1

说明/提示

In the first sample, Jon Snow cannot support steward with strength 11 because there is no steward with strength less than 11 and he cannot support steward with strength 55 because there is no steward with strength greater than 55 .

In the second sample, Jon Snow can support steward with strength 22 because there are stewards with strength less than 22 and greater than 22 .

首页