#================================================
def General_Binary_Decrease_Search(L,R,cond,Integer=True,ep=1/(1<<20),Times=50):
    """条件式が単調減少であるとき,一般的な二部探索を行う.
    L:解の下限
    R:解の上限
    cond:条件(1変数関数,広義単調減少 or 広義単調減少を満たす)
    Integer:解を整数に制限するか?
    ep:Integer=Falseのとき,解の許容する誤差
    """

    if not(cond(L)):
        return None

    if cond(R):
        return R

    if Integer:
        L-=1
        while R-L>1:
            C=L+(R-L)//2
            if cond(C):
                L=C
            else:
                R=C
        return L
    else:
        while (R-L)>=ep and Times:
            Times-=1
            C=L+(R-L)/2
            if cond(C):
                L=C
            else:
                R=C
        return L

def Floor_Root(a,k):
    """floor(a^(1/k)) を求める.

    a:非負整数
    k:正の整数
    """
    assert 0<=a and 0<k
    if a==0:
        return 0
    if k==1:
        return a

    #大体の値を求める.
    x=int(pow(a,1/k))

    #増やす
    while pow(x+1,k)<=a:
        x+=1

    #減らす
    while pow(x,k)>a:
        x-=1
    return x
#================================================
def f(x):
    D=K*K+4*x
    R=Floor_Root(D,2)
    if R**2!=D:
        return None

    b=-K+R
    if b%2==1:
        return None
    else:
        return b//2

#================================================
from collections import defaultdict
N,K,M=map(int,input().split())


#B=1の解の範囲を求める.
alpha=General_Binary_Decrease_Search(0,N,lambda x:x*(x+K)<=N)

#B>=2の解を求める.
F=defaultdict(int)
a=1
while a*(a+K)*(a+2*K)<=N:
    p=a*(a+K)*(a+2*K)
    F[p]+=1

    q=a+3*K
    while p*q<=N:
        p*=q
        F[p]+=1
        q+=K
    a+=1

if M>=2:
    Ans=0
    for n in F:
        b=0
        t=f(n)
        if t!=None and 1<=t<=alpha:
            b=1

        if F[n]+b==M:
            Ans+=1
else:
    Ans=0
    beta=alpha
    for n in F:
        if F[n]==1:
            t=f(n)
            if t==None or not(1<=t<=alpha):
                Ans+=1
            else:
                beta-=1
        else:
            t=f(n)
            if t!=None and 1<=t<=alpha:
                beta-=1
    Ans+=beta
print(Ans)