a,b,c = map(int, raw_input().split()) if a == b or b == c or c == a: print 0 elif (b > a and b > c) or (b < a and b < c): print 'INF' else: m = max(a,max(b,c)) ct = 0 for d in range(3,m+1): x = a % d y = b % d z = c % d if (y > x and y > z and x != z) or (y < x and y < z and x != z): ct += 1 print ct