while True:
    try:
        n=int(input())
        list1=[]
        result=0
        if n<=5:
            print("0")
        else:
            for i in range(1,n):
                list1=[]
                for j in range(1,i):
                    if i%j==0:
                        list1.append(j)
                if sum(list1)==i:
                    result+=1
        print(result)
    except:
              break
            #暴力法,没啥好说的。