def chk(a,b,c) a!=b && a!=c && b!=c && ([a,b,c].min == b || [a,b,c].max == b) end a,b,c=gets.split.map(&:to_i) if chk(a,b,c) puts "INF" exit end count = 0 (1..1000).each{|p| count += 1 if chk(a%p, b%p, c%p) } puts count