a, b, c = map(int, input().split()) def judge(a, b, c): if b > a and b > c or b < a and b < c and not a == c: return True else: return False def f(): count = 0 if a == c: return '0' if judge(a, b, c): return 'INF' for i in range(1, max(a, b, c)+2): if judge(a%i, b%i, c%i): count += 1 return count print(f())