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

#SP0000166. Phép thuật tách bóng thành thừa số nguyên tố (Magic For Balls)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Phép thuật tách bóng thành thừa số nguyên tố (Magic For Balls)

Magic For Balls

Source: AtCoder Typical90 075
Version: Phuoc Hung OJ Extended — one dataset per judge run.

Problem Statement

Initially one ball contains NN. In one operation all balls are struck simultaneously: prime-numbered balls stay unchanged, while a composite-numbered ball xx is replaced by any two balls with factors a,b≥2a,b\ge2 and ab=xab=x. Minimize the number of operations until all balls are prime-numbered.

Input

One line containing the integer NN.

Output

Print the minimum number of simultaneous operations.

Subtasks

  • Subtask 1 (20 points): 2≤N≤100002\le N\le 10000.
  • Subtask 2 (30 points): 2≤N≤1000000002\le N\le 100000000.
  • Subtask 3 (50 points): 2≤N≤10000000000002\le N\le 1000000000000.

Example

Input

42

Output

2

Explanation

Since 42=2⋅3⋅742=2\cdot3\cdot7, it has three prime factors counted with multiplicity. Two simultaneous splitting operations suffice.