cswork / OAOpen practice workspace

AmazonOA #196

Get Exp.

Estimated EasyJudge-ready

Topics (AI-labelled)Two PointersHashing

Repeatedly take the two people with the highest and the lowest remaining experience, pair them and remove them; count the distinct values among the pairs' average experience. People with the same experience are still separate individuals.

Input

The first line contains an even n; the second line contains n experience values. 2≤n≤100000, 0≤experience≤10^9.

Output

Output a single integer, the answer.

Example 1

Input:

6
1 4 1 3 5 6

Output:

2

Example 2

Input:

2
0 0

Output:

1

Example 3

Input:

4
1 100 10 1000

Output:

2

Example notes

The answers are 2, 1 and 2; the sums in the first example are 7, 6 and 7.

Editorial

Loading solution…