Instead of panicking on unsorted input, the function should sort the input and print a debug message.