PDP-22 (2010) - Camp junior - 2 (sumofpow)

View as PDF

Submit solution

Points: 30 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem types
Allowed languages
C, C++, Java, Pascal, Python

Sum of Powers

Write a program that reads a natural number N and prints the count of natural numbers that do not exceed N and can be expressed as the sum of a power of 2, a power of 3, and a power of 5 (e.g., 42 = 16 + 1 + 25 = 2^4 + 3^0 + 5^2 ).

Input

Only one line containing the number N.

Output

Only one line containing exactly one natural number: your answer.

Example of Input - Output Files:

STDIN (sumofpow.in)

10

STDOUT (sumofpow.out)

8
Constraints
  • 1 \le N \le 5.000.000.

Comments

There are no comments at the moment.