#!/usr/sbin/python # -*- coding: utf-8 -*- while True: try: it_i = int(input()) x = 1 y = 0 while x <= it_i: i_input = x i_list = [] for i in range(1, int(i_input/2)+1): if i_input % i == 0: i_list.append(i) result = 0 for j in i_list: if j != i_input: result += int(j) if i_input == result: y += 1 x += 1 print(y) except: break