package no358; 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(); if (isKadomatsuSequence(a, b, c)) { System.out.println("INF"); }else{ int max = Math.max(a, Math.max(b, c)); int count = 0; for(int p=1;p<=max;p++) { if (isKadomatsuSequence(a % p, b % p, c % p)) { // System.out.println(p); count++; } } System.out.println(count); } } public static boolean isKadomatsuSequence(long a,long b,long c) { if (a == b || b == c || a == c) { return false; } return b < a && b < c || b > a && b > c; } }