while True: try:

    a = int(input())
    
    d = []
    
    for i in range(2, a+1):
        s = 0
        for j in range (1, int(i/2+1)):
            
            if i%j ==0:
                s += j                
        if i == s:
            d.append(i)
    
    print(len(d))
except:
    break