No Story (AOJ 1060) by letter
Contest: 3575    RunID: 2376221    Status: Time Limit Exceeded    Date: Sat Jun 17 16:28:51 JST 2017


#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;

#define DEBUG false

#define MAXI 1000001

int main(){

	ll l;
	vector<ll> prime;
	bool used[MAXI] = {false};
	REP(i, 2, MAXI){
		if(!used[i]) prime.push_back(i);
		for(int j = 2; i * j < MAXI; j++) used[i*j] = true;
	}
	
	while(cin >> l, l){
		vector<ll> cnt(prime.size());
		ll tmp = l;
		rep(i, prime.size()){
			while(tmp != 1 && tmp % prime[i] == 0) {
				cnt[i]++;
				tmp /= prime[i];
			}
		}
		
		ll ans = 2;
		ll mul = 1;
		bool flag1 = false, flag2 = false;
		rep(i, cnt.size()){
			if(prime[i] == l) break;
			ans += cnt[i];
			if(cnt[i] > 0){
				if(flag1) flag2 = true;
				flag1 = true;
				mul *= (cnt[i] * 2);
			}
		}
		if(flag1) ans--;
		if(flag2) ans += (mul / 2);
		
		cout << ans << endl;
	}
	
	
	
	return 0;
}