order statistic rewrite