#include<stdio.h>

int main(){

int number;
while(scanf("%d", &number) != EOF){
    int count = 0;
    for(int i=1; i<=number; i++){
        int all = 0;
        for(int j=1; j<i; j++){
            if(i%j==0)all+=j;
        }
        if(all == i)count++;
    }
    printf("%d\n", count);
}

}