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

#SP0000159. Các số vui vẻ (Joyful Numbers)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Các số vui vẻ (Joyful Numbers)

Joyful Numbers

Source: Codeforces Gym 103098J
Version: Phuoc Hung OJ Extended (one dataset per execution; batched queries remain together).

Problem Statement

A positive integer nn is joyful if appending the digits 25 to the right of nn gives a perfect square. For example, 22 is joyful because 225=152225=15^2. Given kk, count the distinct prime factors of the kk-th joyful number in increasing order.

Input

One integer kk.

Output

Print the number of distinct prime factors.

Subtasks

  • Subtask 1 (20 points): 1≤k≤10001\le k\le 1000.
  • Subtask 2 (30 points): 1≤k≤1061\le k\le 10^6.
  • Subtask 3 (50 points): 1≤k≤1091\le k\le 10^9.

Sample Input

4

Sample Output

2

Sample Explanation

The fourth joyful integer equals 4⋅5=20=22⋅54\cdot5=20=2^2\cdot5, so it has two distinct prime factors.