#include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)< pii; typedef vector vi; typedef vector vll; bool check(vi v){ if(v[0] == v[1] || v[1] == v[2] || v[2] == v[0])return false; return (v[0] < v[1] && v[1]>v[2]) || (v[0] > v[1] && v[1] < v[2]); } int main(){ ios::sync_with_stdio(0); cin.tie(0); vi A(3), B(3); while(cin >> A[0] >> A[1] >> A[2]){ if(check(A)){ cout << "INF" << endl; } else{ int answer = 0; for(int i = 1; i <= 1000; ++i){ rep(j, 3)B[j] = A[j] % i; if(check(B))++answer; } cout << answer << endl; } } }