def isKadomatu(a1,a2,a3): if len({a1,a2,a3})==3 and (max(a1,a2,a3)==a2 or min(a1,a2,a3)==a2): return True else: return False a1,a2,a3 = map(int,input().split()) if isKadomatu(a1,a2,a3): print("INF") else: r=0 for p in range(1,max(a1,a2,a3)+1): b1,b2,b3=a1%p,a2%p,a3%p if isKadomatu(b1,b2,b3): r+=1 print(r)