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

#SP0000177. Số bán nguyên tố H (Semi-prime H-numbers)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Số bán nguyên tố H (Semi-prime H-numbers)

Semi-prime H-numbers

Phuoc Hung OJ ID: PRIME000182
Source: UVa 11105 (PHOJ Extended, one input instance per run).

Problem statement

An H-number is a positive integer of the form 4k+14k+1, where k≥0k\ge 0. One is the unique unit. An H-number greater than 1 is an H-prime if it cannot be expressed as the product of two H-numbers greater than 1. An H-semiprime can be expressed as the product of two H-primes, possibly equal. Given an H-number hh, count all H-semiprimes from 1 through hh, inclusive.

Input

One integer hh, which is an H-number.

Output

Print h cnt, where cnt is the number of H-semiprimes not exceeding hh.

Subtasks

  • Subtask 1 (20 points): 1≤h≤3 0011\le h\le3\,001, h≡1(mod4)h\equiv1\pmod4.
  • Subtask 2 (30 points): 3 005≤h≤100 0013\,005\le h\le100\,001, h≡1(mod4)h\equiv1\pmod4.
  • Subtask 3 (50 points): 100 005≤h≤1 000 001100\,005\le h\le1\,000\,001, h≡1(mod4)h\equiv1\pmod4.

Example

Input

85

Output

85 5

Explanation: There are five H-semiprimes up to 85: 25, 45, 65, 81 and 85.