#include <stdio.h>
#include "math.h"

int main() {
    int n;
    scanf("%d", &n);
    int i, pub = 0; //公因数
    int count = 0 ; //完全数个数
    int sum = 0; //公因数的和
    for (i = 2; i <= n; i++) {
        sum = 1; //1是所有数的公因数
        for (pub = 2; pub <= sqrt(i); pub++) {
            if (i % pub == 0) {
                sum += pub;
                if (pub != sqrt(i)) //公因数与数的平方根相等时只能加一次
                    sum += (i / pub);
            }
        }
        if (sum == i)
            count++;
    }

    printf("%d\n", count);
}