A1, A2, A3 = map(int, input().split()) if A1 != A2 and A2 != A3 and A3 != A1 and (max(A1,A2,A3) == A2 or min(A1,A2,A3) == A2): print("INF") else: count = 0 for i in range(3,max(A1,A2,A3) + 1): B1 = A1 % i B2 = A2 % i B3 = A3 % i if B1 != B2 and B2 != B3 and B3 != B1 and (max(B1,B2,B3) == B2 or min(B1,B2,B3) == B2): count += 1 print(count)