def is_PN(num):
    i = 2
    summ = 1
    while i ** 2 <= num:
        if num % i == 0:
            summ += i
            summ += num / i
        i += 1
    return summ == num

while True:
    try:
        countt = 0
        for j in range(1, int(input())+ 1):
            if is_PN(j):
                countt += 1
        print(countt - 1)
    except:
        break