New function to compute order statistics on a list