import sys from collections import defaultdict def main(): N, K, M = map(int, sys.stdin.readline().split()) count = defaultdict(int) max_B = 0 B = 1 while True: # Compute minimal product for B: A=1 product_min = 1 valid = True for i in range(B + 1): term = 1 + i * K if product_min > N // term: valid = False break product_min *= term if product_min > N: valid = False break if not valid: break # Binary search for A_max low = 1 high = 1 while True: product = 1 for i in range(B + 1): term = high + i * K if term > N or product > N // term: product = N + 1 break product *= term if product <= N: high *= 2 if high > N: high = N break else: break a_max = 0 while low <= high: mid = (low + high) // 2 product = 1 for i in range(B + 1): term = mid + i * K if term > N or product > N // term: product = N + 1 break product *= term if product <= N: a_max = mid low = mid + 1 else: high = mid - 1 if a_max == 0: B += 1 continue # Iterate A from 1 to a_max and compute X for A in range(1, a_max + 1): product = 1 for i in range(B + 1): term = A + i * K if term > N or product > N // term: product = N + 1 break product *= term if product <= N: count[product] += 1 B += 1 # Count the X's with exactly M occurrences result = 0 for x in count: if x <= N and count[x] == M: result += 1 print(result) if __name__ == "__main__": main()