#include <stdio.h>
#include <iostream>
#include <algorithm>
#include<string>
#include <math.h>

using namespace std;




int main() {
	int a, b, c;
	int i=1;
	int d, e, f;
	int count = 0;
	cin >> a >> b >> c;
	if (a > c) {
		swap(a, c);
	}
	if (a == b || b == c || c == a) {
		cout << "0" << endl;
	}
	else if (b < c&&b < a) {
		cout << "INF" << endl;
	}
	else if (b > c&&b > a) {
		cout << "INF" << endl;
	}
	else {
		while (i < c+1) {
			d = a % i;
			e = b % i;
			f = c % i;
			if (d == f) {}
			else if (d < e&&f < e) {
				count++;
			}
			else if (d > e&&f>e) {
				count++;
			}
			i++;
		}
		cout << count<<endl;
	}
	
	return 0;
}