Close #40. Sort stat array before computing median