#include<bits/stdc++.h>
using namespace std;
bool isAllNum(int num){
int tmp = 0;
for(int i = 1; i < num; i++){
if(num % i == 0){
tmp += i;
}
}
if(tmp == num){
//cout << num<<"是完全数。"<<endl;
return true;
}
return false;
}
int main(){
int num = 0;
while(cin>>num){
int res = 0;
for(int i = 1; i <= num; i++){
if(isAllNum(i)) res++;
}
cout<<res<<endl;
}
return 0;
}