Add function countByValue() and countByKey().