sorting the merge array by size of each row