Logic is not taught in Canadian math classes anymore, and Leo sets out to fix that by adding this logic question to Project Feng.
Leo will give you statements, like so:
Exactly of these statements are true.
Exactly of these statements are true.
Exactly of these statements are true.
…
Exactly of these statements are true.
for all . Leo tells you that some of these statements are true, and others are false. He then asks you, how many of these statements are true?
Input Specification
The first line will contain the positive integer . The next lines each contain a single positive integer, the sequence to .
Output Specification
Output a single nonnegative integer, the number of statements that are true. If there are multiple correct answers, output the greatest. If there are no possible answers, output Paradox!
.
Sample Input 1
4
0
1
2
3
Sample Output 1
1
Sample Input 2
4
4
4
4
4
Sample Output 2
4
Sample Input 3
1
0
Sample Output 3
Paradox!
Explanation for Sample 3
This is an Epimenides paradox. If the statement is true, then it must be false. If the statement is false, then it must be true.
Comments
help I'm always getting 4, 6, and 12 wrong and I don't know why. I think my code is right... Also should 4 1 2 2 4 print 2 or 4?
That test case should print 2. I think your program needs to differentiate between a paradox and 0.
It does, I don't know why it doesn't work!!!
call me dumb but i seriously dont know how its defining either a number is true of false.
Are you talking about the paradox case?
no in general. i dont understand the problem as a whole. how do i know if a number is true?
You can print out zero.
Fixed.
Not according to my screen
Can confirm - if you print 0, you get some test cases correct.