#include <algorithm>
int CountNumberOfSetBits(int number){
int temp=number;
int count=0;
for (int k=0;temp!=0;k++){
temp=(number>>k);
if ((temp%2)==1){
count++;
}
}
return count;
}
bool mycompare(int a,int b){
int count1=CountNumberOfSetBits(a);
int count2=CountNumberOfSetBits(b);
if (count1<=count2){
return false;
}
return true;
}
void sortSetBitsCount(vector<int>& arr, int size)
{ stable_sort(arr.begin(),arr.end(),mycompare);
}