def perf(n):
    res=[]
    for i in range(1,n//2+1):
        if n%i==0:
            res.append(i)
    if sum(res)==n:
        return 1
    else:
        return 0
while 1:
    try:
        n=int(input())
        ans=0
        for i in range(6,n+1):
            if perf(i):
                ans+=1
        print(ans)
    except:
        break