C++ || Sort || O(1) Space
\nclass Solution {\npublic:\n    int maximizeGreatness(vector<int>& nums) {\n        sort(nums.begin(), nums.end());\n        int i=0,n=nums.size(),ans=0;\n    
```\nclass Solution {\npublic:\n    int maximizeGreatness(vector<int>& nums) {\n        sort(nums.begin(), nums.end());\n        int i=0,n=nums.size(),ans=0;\n    \n        for(int k=1;k<n;k++){\n            if(nums[i] < nums[k]){\n                ans++;\n                i++;\n            }\n        }\n        return ans;\n    }\n};\n```
['C', 'Sorting']