a,b,c=map(int,input().split()) e={a,b,c} d=max(e) p=print if len(e)!=3:p(0) elif d==b or min(e)==b:p('INF') else:p(sum(1 for i in range(1,d+1)if len({a%i,b%i,c%i})==3and[max(a%i,b%i,c%i)==b%i,min(a%i,b%i,c%i)]==b%i))