backported collections.Counter [skip ci]