import java.util.*; public class Exercises25{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); int[] array = new int[3]; for (int n = 0; n < 3; n++){ array[n] = sc.nextInt(); } int count = 0; if (array[0] == array[1] || array[0] == array[2] || array[1] == array[2]){ System.out.println(0); }else if (array[1] > array[0] && array[1] > array[2] || array[1] < array[0] && array[1] < array[2]){ System.out.println("INF"); }else{ int bigger = Math.max(array[0], array[1]); int max = Math.max(bigger, array[2]); for (int p = 2; p <= max; p++){ int first = array[0] % p; int second = array[1] % p; int third = array[2] % p; if (first != third){ if (second > first && second > third || second < first && second < third){ count++; } } } System.out.println(count); } } }