This adds the code to count the number of guesses.