You are given a multiset
In each operation, you choose two different elements of the multiset,
Find the minimum number of operations such that every element of
Constraints
Input Specification
The first line contains an integer,
The next line contains
Output Specification
Output the minimum number of operations to set all elements to
Sample Input
2
1 1 1 1 1
Sample Output
5
Explanation for Sample
Let's keep track of the elements in the multiset after each operation.
Initially, the multiset has the elements
- Choose
and - Choose
and - Choose
and - Choose
and - Choose
and
It can be proven that
Comments