import java.util.ArrayList;
import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        ArrayList<Integer> list = new ArrayList<>();
        while (in.hasNextInt()) {
            int n = in.nextInt();
            int count = 0;
            for (int j = 6; j <= n; j++) {
                //存储约数
                for (int i = 1; i <= j / 2; i++) {
                    if (j % i == 0 ) {
                        list.add(i);
                    }
                }
                int temp = 0;
                for (Integer i : list) {
                    temp += i;
                }
                if (temp == j) {
                    count++;
                }
                list.clear();
            }
            if (count != 0) {
                System.out.println(count);
            } else System.out.println("-1");

        }
    }
}