while True:
    try:
        b=0
        n=int(input())
        for i in range(1,n+1):
            a=0
            for j in range(1,i):
                if i%j == 0:
                    a+=j
                else:
                    continue
            if a == i:
                b+=1
        print(b)
    except:
        break