Problem:
Score : 400 points

Problem Statement

Given is a positive integer N. Consider repeatedly applying the operation below on N:

First, choose a positive integer z satisfying all of the conditions below:

z can be represented as z=p^e, where p is a prime number and e is a positive integer;

z divides N;

z is different from all integers chosen in previous operations.

Then, replace N with N/z.

Find the maximum number of times the operation can be applied.

Constraints

All values in input are integers.

1 \leq N \leq 10^{12}

Input

Input is given from Standard Input in the following format:

N

Output

Print the maximum number of times the operation can be applied.

Sample Input 1

24

Sample Output 1

3

We can apply the operation three times by, for example, making the following choices:

Choose z=2 (=2^1). (Now we have N=12.)

Choose z=3 (=3^1). (Now we have N=4.)

Choose z=4 (=2^2). (Now we have N=1.)

Sample Input 2

1

Sample Output 2

0

We cannot apply the operation at all.

Sample Input 3

64

Sample Output 3

3

We can apply the operation three times by, for example, making the following choices:

Choose z=2 (=2^1). (Now we have N=32.)

Choose z=4 (=2^2). (Now we have N=8.)

Choose z=8 (=2^3). (Now we have N=1.)

Sample Input 4

1000000007

Sample Output 4

1

We can apply the operation once by, for example, making the following choice:

z=1000000007 (=1000000007^1). (Now we have N=1.)

Sample Input 5

997764507000

Sample Output 5

7

Solution in C++ (GCC 9.2.1) (judge verdict: Time Limit Exceeded)


#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;

#define rep(i,n)  for(int i = 0; i < (int)(n);    i++)
#define sz(x)     ((int)(x).size())
#define all(x)    (x).begin(),(x).end()

using ll = long long;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }

std::vector<ll> pFactorization(ll n) {
  std::vector<ll> rtn;
  for(int i=2; i*i<=n; i++) {
    if ( n % i != 0 ) continue;
    rtn.push_back(i);
    while( n%i == 0 ) n/=i;
  }
  if ( n != 1 ) rtn.push_back(n);
  return rtn;
}

int solve(ll n) {
  if ( n == 1 ) return 0;
  if ( n == 2 ) return 1;
  int rtn = 0;
  ll t = n;
  int i = 1;
  for(i=2; i*i<=t; i++) {
    if ( n % i != 0 ) continue;
    rtn++;
    n /= i;
  }
  if ( n != 1 && i-1 < n ) rtn++;
  return rtn;
}

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  ll N; std::cin >> N;

  /*
  auto P = pFactorization(N);
  std::vector<int> e(sz(P));
  ll T = N;
  for(int i=0; i<sz(P); i++) {
    int cnt = 0;
    while( T % P[i] == 0 ) {
      cnt++;
      T /= P[i];
    }
    e[i] = cnt;
  }

  for(int i=0; i<sz(P); i++) {
    std::cout << P[i] << " " << e[i] << std::endl;
  }
  */
  std::cout << solve(N) << std::endl;
  return 0;
}