Little Daniel has a bag of candy and
Each of the cards has a positive integer
He wants to tie together pairs of cards in a way that, when he lifts one of them, all the rest are also lifted up. Each card can be directly connected with a tie to any number of other cards. As Daniel is watching his figure, he doesn't want to consume too much, so he is asking you to calculate the minimal number of candy he must eat so all cards are connected.
Input Specification
The first line of input contains the positive integer
Each of the following
Output Specification
The first and only line of output must contain the required value from the task.
Scoring
In test cases worth
In test cases worth
In test cases worth
Sample Input 1
4
2
6
3
11
Sample Output 1
1
Explanation for Sample Output 1
Daniel can connect the first and second card and eat
Sample Input 2
4
1
2
3
4
Sample Output 2
0
Sample Input 3
3
4
9
15
Sample Output 3
4
Comments