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