44ms beats 99.26% solve by sorting and two pointers
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: $$O(nlgn)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int maximizeGreatness(vector<int>& nums) {\n        sort(nums.begin(), nums.end());\n        int i = 0, idx = 0, ans = 0;\n        while(idx < nums.size()){\n            while(nums[i] >= nums[idx]){\n                idx++;\n                if(idx == nums.size()) return ans;\n            }\n            ans++;\n            idx++;\n            i++;\n        }\n\n        return ans;\n    }\n};\n\nauto init = []()\n{ \n    ios::sync_with_stdio(0);\n    cin.tie(0);\n    cout.tie(0);\n    return \'c\';\n}();\n```
['Array', 'Two Pointers', 'Greedy', 'Sorting', 'C++']