How do I count the number of occurrences of the invalid input when the user enter the wrong input