a,b,c,i=2,d;main(){scanf("%d%d%d",&a,&b,&c);for(;i<9999;i++)d+=(a%i-b%i)*(c%i-b%i)>0&&a%i-c%i?1:0;printf(d>999?"INF":"%d",d);}