import java.io.*;
import java.util.*;

public class Main {

    public static void main (String [] args) throws IOException {
        // Use BufferedReader rather than RandomAccessFile; it's much faster
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

        String line = null;
        while ((line = f.readLine()) != null)
        {
            int n = Integer.parseInt(line);
            int count = 0;
            while (n > 0)
            {
                int sum = 0;
                for (int i = 1; i < n; i++) 
                {
                    if (n % i == 0) sum += i;
                    if (sum > n) break;
                }
                if (sum == n) 
                {
                    count++;
                }
                n--;
            }
            out.println(count);
        }
        out.close();
        f.close();
    }
}