#include <iostream>

using namespace std;

int main(){
	int n, x;
	while(cin >> n){
		int x = 0;
		int sum;
	
		for(int i = 1;i <= n;i++){
			sum = 0;
			for(int j = 1; j <= i; j++){
				if( i % j == 0) sum += j;{
					if(sum == i + 1) x++;
				}
			}
		}
		
		cout << x << endl;
	}
	
	return 0;
}