Three Kangaroos 2

No attempts yetTime limit1sMemory limit256 MB

Problem

Three kangaroos play in a desert. The desert holds one number line, and the three kangaroos sit on three different integer coordinates.

In one move, one of the two outer kangaroos jumps to an integer coordinate between the other two kangaroos. Two or more kangaroos can never sit on the same coordinate.

Find the largest number of moves the kangaroos can make.

Input

The input holds several test cases. Each line gives the starting positions AA, BB, CC of the three kangaroos. (0<A<B<C<1000 < A < B < C < 100)

The number of test cases is not given. Read until the end of the input.

Output

For each test case, print the largest number of moves the kangaroos can make, one per line.