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 Rust (1.42.0) (judge verdict: Wrong Answer)

//use itertools::Itertools;
use std::cmp;
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::io::Read;
use std::usize::MAX;

macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        n: usize
    }

    let mut ans = 0;

    let primes = eratosthenes((n as f64).sqrt() as usize + 2);
    let mut used = HashSet::new();

    let mut fighters = vec![];

    for i in 0..primes.len() {
        let fighter = primes[i];
        let mut big_fighter = fighter;
        while big_fighter < n && n % big_fighter == 0 {
            fighters.push(big_fighter);
            big_fighter *= fighter;
        }
    }

    //println!("{:?}", fighters);

    let mut using = vec![];

    fighters.sort();

    let mut n = n;
    for i in 0..fighters.len() {
        if n % fighters[i] == 0 {
            n = n / fighters[i];
            used.insert(fighters[i]);
            ans += 1;
            using.push(fighters[i]);
        }
    }

    if n != 1 {
        for i in 0..using.len() {
            if n % using[i] == 0 {
                n = n / using[i];
            }
        }
        if n != 1 {
            ans += 1;
        }
    }

    println!("{:?}", ans);
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();

    /*
    // 入力を一括で読み込む場合
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut input = buf.split_whitespace();

    // inputに対しnext()で読み込んでいく
    let q: usize = input.next().unwrap().parse().unwrap();
    */
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet
fn eratosthenes(n: usize) -> Vec<usize> {
    let mut prime_list: Vec<usize> = Vec::new();
    let mut search_list: VecDeque<usize> = VecDeque::new();
    let n_sqrt = (n as f64).sqrt() as usize;

    for i in 2..n + 1 {
        search_list.push_back(i);
    }

    if search_list.len() == 0 {
        return prime_list;
    }

    while true {
        let new_prime = match search_list.pop_front() {
            Some(x) => x,
            None => panic!(),
        };

        prime_list.push(new_prime);

        // search_listからの除外
        search_list = search_list
            .iter()
            .filter(|x| **x % new_prime != 0)
            .map(|x| *x)
            .collect();

        if search_list.front() == None {
            break;
        }

        if search_list.front().unwrap() > &n_sqrt {
            break;
        }
    }

    while search_list.len() > 0 {
        prime_list.push(search_list.pop_front().unwrap());
    }

    return prime_list;
}