#B4070. Maximum Amazing Numbers

    ID: 11727 Type: Default 1000ms 256MiB

Maximum Amazing Numbers

Maximum Amazing Numbers

We call a positive integer \(x\) an amazing number if and only if \(x = p^a\) for some prime \(p\) and a positive integer \(a\). For example, \(8 = 2^3\) is amazing while \(6\) is not.

Given a positive integer \(n\), your task is to construct a set of \(m\) distinct amazing numbers \(\{x_1, x_2, \cdots, x_m\}\) such that the product \(x_1 \times x_2 \times \cdots \times x_m\) is a divisor of \(n\). In other words, \(x_1 \times x_2 \times \cdots \times x_m\) must divide \(n\) exactly. The goal is to maximize \(m\), the number of amazing numbers in the set.

Note: Each amazing number is of the form \(p^a\), where \(p\) is a prime and \(a \ge 1\). For each prime factor \(p\) that divides \(n\) with exponent \(e\), you can choose at most \(s\) amazing numbers based on \(p\), where \(s\) is the maximum integer satisfying \(\frac{s(s+1)}{2} \le e\). The final answer is the sum of such \(s\) across all prime factors of \(n\).

inputFormat

The input consists of a single line containing one positive integer \(n\) (\(1 \le n \le 10^{12}\)).

outputFormat

Output a single integer representing the maximum number of amazing numbers that can be selected such that their product is a divisor of \(n\).

sample

1
0