White hats
Easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
There are a number of people in a room, each wearing either a black or white hat. Every person counts the number of other people wearing white hats. Determine the total number of people wearing white hats, or indicate that the input data does not correspond to a valid situation.
Input
Each line provides one test case, containing a sequence of numbers , where represents the number of hats counted by - th person.
Output
For each test case print on a separate line the number of people wearing white hats, or if the input data does not correspond to a valid situation.
Examples
Input #1
Answer #1
Submissions 1K
Acceptance rate 19%