a = [int(x) for x in input().split()] if a[0] != a[2] and (a[0] < a[1] > a[2] or a[0] > a[1] < a[2]): print('INF') else: res = 0 ma = max(a) aa = [[ai % d for ai in a] for d in range(2, ma + 1)] for aai in aa: if aai[0] == aai[2]: continue if aai[0] < aai[1] > aai[2] or aai[0] > aai[1] < aai[2]: res += 1 print(res)