Sloppy counter implementation

Example from textbook