Counter solution to quiz.

solution using a counter