import sys if sys.platform =='ios': import clipboard a=clipboard.get() a = a.split('\n') text = '\n'.join(a) with open('input_file.txt','w') as f: f.write(text) sys.stdin = open('input_file.txt') A1, A2, A3 = map(int, input().split()) ans = 0 if A1 == A3: print(0) exit() if (A1 > A2 and A3 > A2) or (A1 < A2 and A3 < A2): print('INF') exit() for i in range(2, 1000 + 1): B1 = A1 % i B2 = A2 % i B3 = A3 % i if B1 != B3 and ((B1 > B2 and B3 > B2) or (B1 < B2 and B3 < B2)): ans += 1 print(ans)