Олимпиадный тренинг

Задача 38239. Preference


Задача

Темы: Циклы Перебор
In some card game, a deck is used, in which there are 4 aces. 4 players take part in the game, each of which is dealt an equal number of cards, and two cards are put aside.

Each player boasted how many aces he had. Determine how many players knowingly lied.

For example, they said 1, 1, 1, 2. Therefore, 1 player obviously lied. (Some three could tell the truth, but all four could not tell the truth, since there are only 4 aces).

Input
4 numbers are entered (from 0 to 9 each), separated by a space – the number of aces according to the first, second, third and fourth players.

Imprint
Print one number – the minimum number of players who knowingly lied. If everyone could tell the truth at the same time, print the number 0.
Examples
# Input Output
1 1 1 1 2 1
2 1 1 1 1 0