C# Sort an array by absolute value dose not work as intend with a input array : Sorting arrays by absolute value using a input array refuses to work but replacing it with a simple array works. I have no idea why it wont work, I just dont see whats wrong.

I need the result to be like this:

Input: -5 4 8 -2 1 

Output: 1 -2 4 -5 8

    
        static void Main()
        {


            var sampleInput =  Console.ReadLine().Split().Select(int.Parse).ToArray();

            int[] x = sampleInput;
            int n = sampleInput.Length;

                int[] output = new int[n];

                string sOutput = string.Empty;

                int start = 0;

                int last = n - 1;

                while (last >= start)
                {

                    n--;

                    if (Math.Abs(x[start]) > Math.Abs(x[last]))
                    {

                        output[n] = x[start++];

                    }
                    else
                    {

                        output[n] = x[last--];

                    }

                    sOutput = output[n].ToString() + " " + sOutput;

                }

                Console.Write(sOutput);

               

            
        }