atcoder#ARC123A. [ARC123A] Arithmetic Sequence

[ARC123A] Arithmetic Sequence

Score : 300300 points

Problem Statement

Given is a sequence of three integers A=(A1,A2,A3)A = (A_1, A_2, A_3). On this sequence, you can do the following operation any number of times:

  • choose i{1,2,3}i\in \{1,2,3\} and add 11 to AiA_i.

Find the minimum number of operations needed to make AA arithmetic. Here, the sequence A=(A1,A2,A3)A = (A_1, A_2, A_3) is arithmetic when A2A1=A3A2A_2 - A_1 = A_3 - A_2 holds.

Constraints

  • 1A1,A2,A310151\leq A_1, A_2, A_3\leq 10^{15}

Input

Input is given from Standard Input in the following format:

A1A_1 A2A_2 A3A_3

Output

Print the answer.

4 8 10
2

One operation with i=1i = 1 and then one operation with i=3i = 3 yield an arithmetic sequence (5,8,11)(5, 8, 11).

10 3 4
4

Four operations with i=2i = 2 yield an arithmetic sequence (10,7,4)(10, 7, 4).

1 2 3
0

The sequence AA is already arithmetic from the beginning, so we need zero operations.

1000000000000000 1 1000000000000000
999999999999999