Олимпиадный тренинг

Задача 34851. Leapfrog


The path is paved with tiles in one row, the tiles are numbered from 1 to 1000. On the tiles with numbers A, B and C (A < B < C) there are three grasshoppers who play leapfrog according to the following rules:
1. Only one grasshopper can be placed on one tile.
2. In one move, one of the two outer grasshoppers (that is, from tile A or from tile C) can jump over the middle grasshopper (tile B) and stand on a tile that is exactly in the middle between the two remaining grasshoppers (that is, between B and C or A and B respectively). If there is an even number of tiles between the two remaining grasshoppers, then he can choose any of the two central tiles.
For example, if the grasshoppers originally sat on tiles number 1, 5, 10, then on the first move, the grasshopper from tile number 10 can jump to tile number 3 (it is in the middle between 1 and 5), or the grasshopper from tile number 1 can jump to tile number 7 or 8 (these two tiles are in the middle between tiles 5 and 10).
Three numbers are given: A, B, C. Determine the maximum number of moves the game can go on.

Input data format
The program receives as input three integers A, B and C (1 <= A < B < C <= 1000) written on separate lines.
Output data format
Print one number — the maximum number of moves that the game can go on.
 
Input Output Note
1
4
6
2 In the example, first the grasshopper jumps from tile 6 to tile 3. Then the grasshopper jumps from tile 4 to tile 2.