Freshworks Interview Question

Given an array, replace the duplicate elements by incrementing them until all the array elements are unique. Calculate the minimum sum of the array after this.