fn main() { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); let n: Vec = s.split_whitespace().flat_map(str::parse).collect(); let l = |a: u32, b, c| { a != b && b != c && c != a && (b == a.max(b).max(c) || b == a.min(b).min(c)) }; if l(n[0], n[1], n[2]) { println!("INF"); return; } println!( "{}", (2..=n[0].max(n[1]).max(n[2])) .filter(|i| l(n[0] % i, n[1] % i, n[2] % i)) .count() ) }