Easy c++ sorting + two poiner  based solution
Intuition\n Describe your first thoughts on how to solve this problem. \nIn this question i observed the ans can be maximum as nums.size()-1 when all elements a
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nIn this question i observed the ans can be maximum as nums.size()-1 when all elements are unique.We can check this in sorted array from index n-2 till 0,where n is size of nums.size().\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. Sort the array,intialise ans as 1 , and a pointer ind as n-1.\n2. Traverse the array from n-2 to 0. Check if(nums[i]<nums[ind]) if its true then decrement the ind by 1 and increase the ans by 1.\n3. Return the ans.\n# Complexity\n- Time complexity:N*log(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n\n- Space complexity:O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int maximizeGreatness(vector<int>& nums) {\n        sort(nums.begin(),nums.end());\n        int n=nums.size();\n        int ans=0;\n        int ind=n-1;\n        for(int i=n-2;i>=0;i--)\n        {\n            if(nums[i]<nums[ind])\n            {\n                ind--;\n                ans++;\n            }\n        }\n        return ans;\n    }\n};\n```
['Two Pointers', 'Sorting', 'C++']