Implementation of ValueCounter which allows counting unique values.