while True:
    try:
         n=int(input())
         L=[]
         for i in range(1,n):
             p=0
             for y in range(1,i):
                 if i%y==0:
                     p=p+y
             if i==p:
                 L.append(p)
         print(len(L))
    except:
        break