import sys input=lambda: sys.stdin.readline().rstrip() A=[int(i) for i in input().split()] def chk(A): if A[1]A[0] and A[1]>A[2] and A[0]!=A[2]: return True else: return False if chk(A): print("INF") else: ans=0 for i in range(1,max(A)+1): B=[] for a in A: B.append(a%i) if chk(B): ans+=1 print(ans)