a,b,c=map(int,input().split()) M=max(a,b,c) z=0 for p in range(1,M+9): B=[a%p,b%p,c%p] if len(set(B))!=3:continue if B[1]==max(B) or B[1]==min(B): if p>M:print('INF');exit() else:z+=1 print(z)