a1, a2, a3 = map(int, input().split()) def solve(a1, a2, a3): if is_kado(a1, a2, a3): return "INF" count = 0 maxA = max(a1, a2, a3) for p in range(1, maxA + 1): if is_kado(a1 % p, a2 % p, a3 %p): count += 1 return count def is_kado(a, b, c): return ((a < b and b > c) or (a > b and b < c)) and a != c print(solve(a1, a2, a3))