Sort consumes and produces array.