#arc123a. [arc123_a]Arithmetic Sequence
[arc123_a]Arithmetic Sequence
Problem Statement
Given is a sequence of three integers . On this sequence, you can do the following operation any number of times:
- choose and add to .
Find the minimum number of operations needed to make arithmetic. Here, the sequence is arithmetic when holds.
Constraints
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
4 8 10
Sample Output 1
2
One operation with and then one operation with yield an arithmetic sequence .
Sample Input 2
10 3 4
Sample Output 2
4
Four operations with yield an arithmetic sequence .
Sample Input 3
1 2 3
Sample Output 3
0
The sequence is already arithmetic from the beginning, so we need zero operations.
Sample Input 4
1000000000000000 1 1000000000000000
Sample Output 4
999999999999999