Simple C++ Solution
Code\n\nclass Solution {\npublic:\n    int maximizeGreatness(vector<int>& nums) {\n        sort(nums.begin(),nums.end());\n        int i=0,j=1;\n        while(j
# Code\n```\nclass Solution {\npublic:\n    int maximizeGreatness(vector<int>& nums) {\n        sort(nums.begin(),nums.end());\n        int i=0,j=1;\n        while(j < nums.size()){\n            if(nums[j] > nums[i])\n                i++;\n            j++;\n        }\n        return i;\n    }\n};\n```
['Two Pointers', 'Greedy', 'Sorting', 'C++']