|| MAX-HEAP || C++ SOLUTION||
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int maximizeGreatness(vector<int>& nums) {\n        int n=nums.size();\n        sort(nums.begin(),nums.end());\n        priority_queue<int>maxi;\n        maxi.push(nums[n-1]);\n        int i=n-2;\n        int count=0;\n        while(i>=0)\n        {\n            if(maxi.top()>nums[i])\n            {\n                count++;\n                maxi.pop();\n                maxi.push(nums[i]);\n            }\n            else\n            {\n                maxi.push(nums[i]);\n            }\n            i--;\n        }\n        return count;\n    }\n};\n```
['C++']