A = [int(i)for i in input().split()] ans = 0 if A[0] == A[2]: print(0) elif max(A)==A[1] or min(A)==A[1]: print("INF") else: for i in range(3,max(A)+1): B = [A[0]%i,A[1]%i,A[2]%i] if max(B)==B[1] or min(B)==B[1]: ans += 1 else: print(ans)