a,b,c=map(int,input().split()) e=[a,b,c] d=max(e) p=print if len(set(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(a%i!=b%i and b%i!=c%i and a%i!=c%i)and(max(a%i,b%i,c%i)==b%i or min(a%i,b%i,c%i)==b%i)))