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