import sys import math def count_x_with_f_equals_m(N, K, M): freq = {} max_s = 0 current = 1 s = 1 while current <= N: max_s = s s += 1 current *= (current + K) if s > 1 else 1 for s in range(2, max_s + 1): left = 1 right = 1 while True: try: P = 1 for i in range(s): P *= (right + i * K) if P > N: break right += 1 except: break right -= 1 if right < 1: continue for A in range(1, right + 1): product = 1 for i in range(s): product *= (A + i * K) if product > N: break if product <= N: if product in freq: freq[product] += 1 else: freq[product] = 1 count = 0 for x in freq: if freq[x] == M: count += 1 return count def main(): N, K, M = map(int, sys.stdin.readline().split()) print(count_x_with_f_equals_m(N, K, M)) if __name__ == "__main__": main()