values of even length. While the array is not empty, repeat:
1. Remove the smallest number from the array.
2. Remove the largest number from the array.
3. Write down the average of the two removed numbers.
If several numbers tie for smallest or largest, you may remove any of them; it does not change the answer.
Return how many **distinct** averages you wrote down.values=[7, 2, 9, 4, 6, 1] → 2
Remove 1 and 9, average 5; then 2 and 7, average 4.5; then 4 and 6, average 5. Two distinct averages: 5 and 4.5.
values=[3, 3, 3, 3] → 1
Every pair averages to 3.
values=[0, 100] → 1
values=[7, 2, 9, 4, 6, 1]
2
Run checks the first 3 tests in your browser. Submit checks all 110 tests on the server, hidden ones included.