def is_ks(b): return len(list(set(b)))==3 and (b[1]==min(b) or b[1]==max(b)) a=list(map(int,input().split())) if len(list(set(a)))<3: print(0) elif is_ks(a): print('INF') else: ans=0 for i in range(1,max(a)+1): b=[j%i for j in a] if is_ks(b): ans+=1 print(ans)