You are an array A having N integers. You can do any of the operations any number of times on the array: •choose an integer A[I] from the array and remove all the it's occurance by paying a[I] dollar •choose an I(1<=I<=n) and replace a[I] with A[I]+1 by paying 1 dollar
A[5,4,4,2] Output 9 Explain pay 2 dollar and remove 2 a[5,4,4] Pay 1 dollar and update 4 a[5,4,5] Pay 1 dollar and update 4 a[5,5,5] Pay 5 dollar and remove 5 a[]