def is_kadomatsu(a, b, c): if a == b or a == c or b == c: return False if max([a, b, c]) == b or min([a, b, c]) == b: return True return False def main(): a1, a2, a3 = map(int, input().split()) if is_kadomatsu(a1, a2, a3): print("INF") else: ans = 0 for p in range(1, max([a1, a2, a3]) + 1): ans += is_kadomatsu(a1 % p, a2 % p, a3 % p) print(ans) if __name__ == '__main__': main()