import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int A[] = new int[3]; for (int i = 0; i < 3; i++) { A[i] = scanner.nextInt(); } System.out.println(new Solver().solve(A)); } } class Solver { public String solve(int[] a) { if (a[0] == a[1] || a[0] == a[2] || a[1] == a[2]) { return "0"; } if (isKadomatsu(a[0], a[1], a[2])) { return "INF"; } int sum = 0; int max = Math.max(Math.max(a[0], a[1]), a[2]); for (int i = 1; i <= max; i++) { int b1 = a[0] % i; int b2 = a[1] % i; int b3 = a[2] % i; if (isKadomatsu(b1, b2, b3)) { sum++; } } return String.valueOf(sum); } private boolean isKadomatsu(int b1, int b2, int b3) { if (b1 == b2 || b1 == b3 || b2 == b3) { return false; } return (b2 > b1 && b2 > b3) || (b2 < b1 && b2 < b3); } }