import java.util.Scanner; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); System.out.println(solve(a, b, c)); sc.close(); } public static String solve (int a, int b, int c) { if (isKadomatsu(a, b, c) && b == 1) return "INF"; if (a == b || a == c || b == c) return "0"; int ret = 0, lim = Math.max(Math.max(a, b), c); for (int i = 2; i <= lim; i++) if (isKadomatsu(a % i, b % i, c % i)) { ret++; //System.out.println(i); } return ret + ""; } public static boolean isKadomatsu (int a, int b, int c) { return ((b < a && b < c) || (b > a && b > c)) && a != b && a != c && b != c; } }