I am trying to sort an array of ints by it's binary form. for example if i have `{1,2,3}` i must convert them to binary then sort them based on how many `1` each has, if the number only has one `1` then it is number 1 and then comes the number that has two `1`s in its binary form and so on.

i tried to use the following two methods but i couldn't do them due to errors and i don't understand. i searched all stackoverflow but can't figure it out, i am stuck for our here in this problem.

```
public static int[] xx = { 1, 2, 3, 4, 5, 6, 87, 8, 9, 7, 5, 24, 58, 63, 10, 11, 87, 20, 22, 90, 14, 17, 19, 21, 18, 24 };

        public string[] ChangeToBinary(int[] data)
        {
            string[] binary = new string[data.Length];
            var i = 0;
            foreach (int d in data)
            {
                string newvalue = Convert.ToString(d, 2);
                binary[i] = newvalue;
                i++;
            }
            return binary;
        }

        public int[] Sort(string[] binaries)
        {
            Array.Sort(binaries, (x, y) => x.Count(z => z == '1') > y.Count(e => e == '1'));
            string[] sorted = binaries.OrderBy(b => b.Count(z => z == '1') > b.Count(e => e == '1'));
        }

```

the two lines inside the `sort` function i know that they are wrong in some point that i dont get can someone tell me how to do it ? i try to say to sort the elements of the array based on the least number of `1`s in the element.

I won;t use both but i put them to show you what i wanted to use.
thanks in advance.