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

#SP0000199. Phân tích thành thừa số không chứa bình phương (Square Free Factorization)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Phân tích thành thừa số không chứa bình phương (Square Free Factorization)

Square Free Factorization

Phuoc Hung OJ ID: PRIME000204
Original source: SPOJ AMR10C

Problem statement

An integer is square-free if no square greater than one divides it. Factor NN into a product of square-free integers using the fewest factors.

Input

One integer NN.

Output

Print the minimum number of square-free factors greater than one whose product is NN.

Subtasks

  • Subtask 1 (20 points): 2≤N≤1002\le N\le 100.
  • Subtask 2 (30 points): 101≤N≤10 000101\le N\le 10\,000.
  • Subtask 3 (50 points): 10 001≤N≤1 000 00010\,001\le N\le 1\,000\,000.

Example

Input

72

Output

3

Explanation: 72=23⋅32=6⋅6⋅272=2^3\cdot3^2=6\cdot6\cdot2. Three square-free factors suffice, and at least three are needed to accommodate three copies of prime 22.