count statistic optimization