A, B, C = map(int, input().split()) if A==B or B==C or C==A: print(0) elif (B < A and B < C) or (B > A and B > C): print('INF') else: ans = 0 for p in range(2, max(A, C) + 1): a, b, c = A % p, B % p, C % p if a != c and ((b < a and b < c) or (b > a and b > c)): ans += 1 print(ans)