C++ Solution || Easy & simple Explanation
Approach\n Describe your approach to solving the problem. \nThis can be easily done by sorting and two pointer approach\n1. Firstly, sort the vector. \n2. Then 
# Approach\n<!-- Describe your approach to solving the problem. -->\nThis can be easily done by sorting and two pointer approach\n1. Firstly, sort the vector. \n2. Then initialize two pointers:\n   one points to the current element and start moving forward with\n   another pointer till we find the greater element from the current\n   element.\n3. If we find greater element increant count and move both the pointers forward. \n# Complexity\n- Time complexity: O(N*log(N))\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```\nclass Solution {\npublic:\n    int maximizeGreatness(vector<int>& nums) {\n        sort(nums.begin(), nums.end());\n        int cnt = 0, i = 0, j = 0;\n        while(i < nums.size() && j < nums.size()){\n            if (nums[i] == nums[j]){\n                while(j < nums.size() && nums[i] == nums[j])\n                j++;\n                if (j < nums.size())\n                cnt++;\n            }\n            else cnt++;\n            i++;j++;\n        }\n        return cnt;\n    }\n};\n```
['C++']