using System; public class Hello { static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var a = long.Parse(line[0]) * 1000L; var b = long.Parse(line[1]) * 1000L; var h = long.Parse(line[2]); var g1 = gcd(a, b); var g2 = gcd(h, g1); a /= g2; b /= g2; h /= g2; var count = 0; while (a > h | b > h) { if ((a < b && a > h) | (b <= a && b < h)) { if (a % 2 == 0) { a /= 2; h *= 2; } else { b *= 2; h *= 4; } count++; } else if ((b <= a && b > h) | (a <= b && a < h)) { if (b % 2 == 0) { b /= 2; h *= 2; } else { a *= 2; h *= 4; } count++; } } Console.WriteLine(count); } public static long gcd(long a, long b) { if (a < b) return gcd(b, a); while (b != 0) { var w = a % b; a = b; b = w; } return a; } }