A = list(map(int, input().split()))

if (A[0] != A[1] and A[1] != A[2] and A[2] != A[0]) and (A[0] > A[1] < A[2] or A[0] < A[1] > A[2]):
    print("INF")
    exit()
maxA = max(A)
ans = 0
for i in range(1, maxA + 1):
    B = [A[j] % i for j in range(3)]
    if (B[0] != B[1] and B[1] != B[2] and B[2] != B[0]) and (B[0] > B[1] < B[2] or B[0] < B[1] > B[2]):
        ans += 1
print(ans)