a,b,c=map(int,input().split()) d=max(a,b,c) if a in[b,c]or b==c:print(0) elif d==b or min(a,b,c)==b:print('INF') else:print(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)))