def is_kadom(a,b,c): if not (a != b and a != c and b != c): return False if max(a,b,c) == b or min(a,b,c) == b: return True return False a, b, c = map(int, input().strip().split(" ")) if is_kadom(a,b,c): print("INF") else: count = 0 for i in range(1, max(a,b,c)+1): if is_kadom(a%i, b%i, c%i): count += 1 print(count)