ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

Open Ural SU Championship 2010

About     Problems     Submit solution     Judge status     Standings
Contest is over

D. Anindilyakwa

Time limit: 0.5 second
Memory limit: 64 MB
The language of Australian aborigines anindilyakwa has no numerals. No anindilyakwa can say: “I've hooked eight fishes”. Instead, he says: “I've hooked as many fishes as many stones are in this pile”.
Professor Brian Butterworth found a meadow with three piles of stones. He decided to determine whether aborigines can count. Professor asked one of the aborigines to point at two piles with the minimal difference of numbers of stones in them and tell what this difference is. The aborigine pointed correctly! He was unable to express the difference with words, so he went to a shore and returned with a pile of the corresponding number of stones.
Professor decided to continue his experiments with other aborigines, until one of them points at two piles with equal number of stones. All piles that aborigines bring from the shore are left at the meadow. So, the second aborigine will have to deal with one more pile, the one brought by the first aborigine.


The only input line contains space-separated pairwise distinct integers x1, x2 and x3 (1 ≤ x1, x2, x3 ≤ 1018), which are the numbers of stones in piles that were lying on the meadow at the moment professor Butterworth asked the first aborigine.


Output the number of aborigines that will have to answer a stupid question by professor.


11 5 9


The first aborigine will point at piles of 11 and 9 stones and will bring a pile of two stones. The second aborigine will point at the same piles and will bring another pile of two stones. The third aborigine will point at two piles of two stones, and the experiments will be over.
Problem Author: Ivan Burmistrov
Problem Source: XV Open USU Championship
To submit the solution for this problem go to the Problem set: 1777. Anindilyakwa