/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { public static void main (String[] args) throws java.lang.Exception { // your code goes here BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] lines = br.readLine().split(" "); int a1 = Integer.parseInt(lines[0]); int a2 = Integer.parseInt(lines[1]); int a3 = Integer.parseInt(lines[2]); if(a1 == a2 || a1 == a3 || a2 == a3){ System.out.println("0"); return; } if((a2 < a1 && a2 < a3) || (a2 > a1 && a2 > a3)){ System.out.println("INF"); return; } int max = Math.max(Math.max(a1,a2),a3); int ans = 0; for(int i=1;i<=max;i++){ if(check(a1%i,a2%i,a3%i)){ ++ans; } } System.out.println(ans); } public static boolean check(int a1,int a2,int a3){ return (a1 != a3) && (a2 != a3) && (a1 != a2) && ((a2 < a1 && a2 < a3) || (a2 > a1 && a2 > a3)); } }