Mr Naman has prepared a question paper for a coding test at PECFEST.
The test consists of N questions with each question having certain marks assigned to it.
However, Mr. Naman has been told by the team leader that each question in the paper should carry a different weight.
This means no two questions can have the same marks.
Mr Naman wants to do this by making minimal changes in the original marks, assigning every question at least as much marks as it originally had.
Find the minimum total marks that he can set the paper for.
Input
1. First-line contains N, the total number of questions in the paper
2. Second-line contains N space-separated integers (sorted) A1, A2 ... An representing the original marks assigned to every question
Output
The minimum total marks Mr Naman can set the paper for
Constraints
1 <= N <= 100000
1 <= A[i] <= 100000
Example Input
3
2 2 4
Example Output
9
Explanation
As two questions have the same marks, max marks for one of them needs to be incremented to 3.
He can set the paper with 2+3+4=9 marks.