In a faraway land, players gathered together to play an exciting card game. Their deck contained 54 cards, including 4 cards of each suit from 2 to king, and 2 jokers. Players were dealt 13 cards, and two cards were discarded.
After the cards were dealt, players took turns stating how many queens they had. However, it is unknown who could have lied.
You need to find out the minimum number of players who could have lied about the number of queens.
Input format
The only line of the input file contains 4 integers (0≤a,b,c,d≤9) — the number of queens each player said they had.
Output format
Print a single number
—
— the minimum number of players who could have lied.
Note
In the first example, the players said they had 10 queens in total. At least two players lied. For example, it is possible that the first player has 0 queens, the second has 2, the third has 1, and the fourth has 1. Then the first and third players lied.
In the second example, each player could have had one queen, in which case only the fourth player lied.
In the third example, it is possible to deal cards in which no one lied.
Limitations
Time limit
1 s
Memory limit
256 MB
Example 1
Input
3 2 4 1
Output
2
Example 2
Input
1 1 1 2
Output
1
Example 3
Input
1 1 1 1
Output
0
Examples code solves.
The code does not pass all tests. I do not understand which variants the code does not take into account?
def solution(number):
total_queens = sum(number)
if total_queens <= 4:
return 0
counts = sorted(number, reverse=True)
liars = 0
while total_queens > 4:
total_queens -= counts[liars]
liars += 1
return liars
def main():
number = list(map(int, input().split()))
print(solution(number))
if __name__ == '__main__':
main()```