Sorting an array in a natural way