PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#SP0000049. Đếm số nguyên tố (Prime Number)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Đếm số nguyên tố (Prime Number)

Prime Number

Source: Aizu Online Judge

Version: Phuoc Hung OJ Extended

Problem Statement

Given an integer nn, count the prime numbers not greater than nn. By definition, 11 is not prime.

Input

One line containing the integer nn.

Output

Print one integer: the number of prime integers from 22 through nn.

Subtasks

  • Subtask 1 (20 points): 1≤n≤1001\le n\le 100.
  • Subtask 2 (30 points): 1≤n≤100001\le n\le 10000.
  • Subtask 3 (50 points): 1≤n≤9999991\le n\le 999999.

Examples

Input

10

Output

4

Explanation

The primes in [2,10][2,10] are 2,3,5,72,3,5,7, exactly four numbers, so the answer is 4.