Farmer John's N cows (2 <= N <= 500) have joined the social network "MooBook".
Each cow has one or more friends with whom they interact on MooBook. Farmer John makes a list of the number of friends for each of his cows, but during the process he becomes distracted, and he includes one extra number by mistake (so his list contains N+1 numbers, instead of N numbers as he intended).
Please help Farmer John figure out which numbers on his list could have been the erroneous extra number.
Input
- Line 1: The integer N.
- Lines 2..2+N: Line i+1 contains the number of friends for one of FJ's cows, or possibly the extra erroneous number.
Output
- Line 1: An integer K giving the number of entries in FJ's list that could be the extra number (K=0 means no number's removal yields a feasible pairing).
- Lines 2..1+K: Each line contains the index (1..N+1) within the input ordering of a number that could potentially be the extra number, in sorted order.
Example 1
Input
4 1 2 2 1 3
Output
3 1 4 5
Output details: Removing the first "1", the other "1", or the "3" each yields a list admitting a feasible friendship pairing.
Discussion
Threads about this problem. Spoilers are collapsed; wrap hints in
||double bars||.No discussion yet. Start a thread if something here needs explaining.