406396: GYM102396 A King's Inspection
Description
The Far Far Away Kingdom treasury is in trouble — the King is coming with an inspection. It is known that the King likes order. So the chief treasurer needs to put the three chests that store the Kingdom gold coins in order. He looked into the chests and found out that they contain $$$a$$$, $$$b$$$ and $$$c$$$ coins, respectively. But the King would definitely like the chests to contain the same number of coins each.
To make the number of coins equal, the chief treasurer started to put additional coins to them with both hands. Each second he chooses two distinct chests and adds one more coin to each one of them.
Help the chief treasurer find out how many seconds he needs to make the number of coins in the chests equal.
InputInput contains three lines.
The first line contains an integer $$$a$$$. The second line contains an integer $$$b$$$. The third line contains an integer $$$c$$$ ($$$1 \le a, b, c \le 5\cdot 10^8$$$).
OutputOutput one integer — the minimum number of seconds that the chief treasurer needs to make the number of coins in the chests equal.
ExamplesInput1 2 3Output
3Input
2 2 2Output
0Note
One optimal strategy for the first test is the following: first, add a coin to chests $$$1$$$ and $$$3$$$, then add a coin to chests $$$1$$$ and $$$2$$$, and again to chests $$$1$$$ and $$$2$$$.
All chests in the second test already contain equal number of coins.