题目描述
你有一个长度为 的数组 ,每次操作你可以选择数组中的两个元素 (需要保证 不在原数组内),然后将 放到数组末尾。求你最多能够对这个数组进行多少次操作。
输入格式
The first line consists of a single integer ().
The second line consists of integers (). All are distinct.
输出格式
Output a single line containing one integer — the maximum number of times the operation can be performed on the given array.
样例输入 #1
5 4 20 1 25 30
样例输出 #1
3
样例输入 #2
3 6 10 15
样例输出 #2
4
提示
In the first example, one of the ways to perform maximum number of operations on the array is:
- Pick and add to the array.
- Pick and add to the array.
- Pick and add to the array.
It can be proved that there is no way to perform more than operations on the original array.
In the second example one can add , then , then , and .
来源
CF766-D