n,k,m = map(int,input().split()) now = m def count_divs(x,y): count = 0 now = x while now <= y: count += y//now now *= x return count ans = 10**20 for i in range(2,int(m**0.5)+1): if now%i: continue div = 0 while now%i == 0: now //= i div += 1 nc = count_divs(i,n) kc = count_divs(i,k) + count_divs(i,n-k) ans = min(ans,(nc-kc)//div) if now != 1: ans = min(ans,count_divs(now,n)-count_divs(now,k)-count_divs(now,n-k)) print(ans)