Question
Make them equal
You are given three integers X, Y and Z. You can perform any oft he operations of these integers any number of times:
Find the minimum number of operations required to make all three equal.
- Choose any two of these integers and increase them by 1
- Choose any 1 of these integers and increase it by 2
Find the minimum number of operations required to make all three equal.
Input
The first line of the input contains 3 space seperated integers, X, Y and Z.
Constraints:
1 <= X, Y, Z <= 109
Constraints:
1 <= X, Y, Z <= 109
Output
Print the minimum number of operations required to make all three integers equal.
Example
Sample Input:
4 5 3
Sample Output:
3
Explaination:
First we increase 3 and 5 by 1 - > [4, 6, 4]
Now we increase both fours by 1, twice - > [6, 6, 6].
4 5 3
Sample Output:
3
Explaination:
First we increase 3 and 5 by 1 - > [4, 6, 4]
Now we increase both fours by 1, twice - > [6, 6, 6].