#嘘解法 N,K,M = map(int,input().split()) def prime_factorize(n): prime = [] f = 2 while(f * f < n): if(n % f == 0): n //= f cnt = 1 while(n % f == 0): n //= f cnt += 1 prime.append((f,cnt)) else: f += 1 if(n != 1): prime.append((n,1)) return prime prime = prime_factorize(M) ans = 10 ** 18 for p,c in prime: cnt = 0 n,k,r = N,K,N - K while(n): n //= p cnt += n while(k): k //= p cnt -= k while(r): r //= p cnt -= r cnt //= c if(ans > cnt): ans = cnt print(ans)