Tea Party

View as PDF

Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

Parsa has invited everyone from the MAPS Beginner Competition to a tea party. He has exactly three teapots, each with infinite capacity. The first teapot contains a litres of tea, the second one contains b litres, and the third one contains c litres, where a, b, and c are non-negative integers.

Parsa believes in equality, so he wants all the teapots to have the exact same amount of tea. In one step, he can pour any real (i.e. fractional allowed) amount of tea from one teapot to another.

Help him determine the minimum number of steps required to make all three teapots contain the same amount of tea.

Input

The only line of input contains three integers a, b, c which is the initial amount of tea in each of the teapots.

Output

Print the minimum number of steps to make all the teapots have equal amount of tea.

Constraints

  • 0 \le a, b, c \le 10^{12}

Example 1

Input
4 5 4
Output
2

Example 2

Input
1 3 2
Output
1

Comments

There are no comments at the moment.