import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] a = new int[3]; for(int i = 0; i < 3; i++) { a[i] = sc.nextInt(); } if((a[0] != a[1]) && (a[0] != a[2]) && (a[1] != a[2])) { int[] b = a.clone(); Arrays.sort(b); int max = b[2]; int min = b[0]; if((a[1] == max) || (a[1] == min)) { System.out.println("INF"); } else { int p = 0; for(int i = 3; i <= max; i++) { int x = a[0] % i; int y = a[1] % i; int z = a[2] % i; int MA = Math.max(x, Math.max(y, z)); int MI = Math.min(x, Math.min(y, z)); if((x != y) && (x != z) && (y != z)) { if((y == MA) || (y == MI)) p++; } } System.out.println(p); } } else { System.out.println(0); } } }