Welcome to my Staline sort C implementation !
You iterate over the array, if an element isn't sorted then you remove it from the array. But the problem is that you often get an array with very few elements if the first integers are pretty big. So I made a function to check the biggest possible resulting array in O(nĀ²).