Given an array of size n.
CGE denotes the value of current greatest element.
You can perform these action several times (probably zero):
1. Choose any two equal elements, lets say their value is val
2. Replace them by another integer new_val s.t, new_val<=max(CGE,val+1)
Note that if size of array is S in step 1 then it will be S−1 after the operation performed in step 2.
And you can add new element after step 2 anywhere in the array, this means order of elements in the array doesn't matter.
After performing the above action as many times as you want, you will have a resultant array RES.
Your task is to maximize CGE of RES.
Input Format -
The first line contains a single integer n which denotes the size of input array.
The second line of input contains n integers which denotes elements of input array.
Output Format -
Print a single integer CGE of RES.
Constraints -
1<n<=105
−109<=ai<=109
First you take a pair of 2's and convert it to 3.
Then you take pair of 3's and convert it to 4.
You can't take further action as their are no two equal elements in the array,so 4 is the required answer.