def iskadomatsu(a,b,c): return a != c and (a > b and c > b or b > a and b > c) A = map(int,raw_input().split()) if iskadomatsu(*A): print "INF" else: cnt = 0 for i in xrange(1,max(A)+1): B = map(lambda x: x % i,A) if iskadomatsu(*B): cnt += 1 print cnt