Problem:
Problem J: No Story

Since I got tired to write long problem statements, I decided to make this problem statement short. For given positive integer L, how many pairs of positive integers a, b (a ≤ b) such that LCM(a, b) = L are there? Here, LCM(a, b) stands for the least common multiple of a and b.

Input

For each dataset, an integer L is given in a line. Input terminates when L = 0.

Output

For each dataset, output the number of pairs of a and b.

Constraints

1 ≤ L ≤ 1012

Sample Input

12
9
2
0

Output for the Sample Input

8
3
2

Solution in C# (judge verdict: Accepted)

using System;
using System.Collections;
using System.Collections.Generic;
 
class TEST{
	static void Main(){
		while(true){
			var l=long.Parse(Console.ReadLine());
			if(l==0)break;
			Sol mySol =new Sol(l);
			mySol.Solve();
		}
	}
}

class Sol{
	public void Solve(){
		if(L==1){
			Console.WriteLine(1);
			return;
		}
		
		Dictionary<long,long> pr=PrimDec(L);
		Dictionary<long,long> highest=new Dictionary<long,long>();
		foreach(long k in pr.Keys){
			highest.Add(k,(long)Math.Pow(k,pr[k]));
		}
		
		
		long Total=0;
		for(long i=1;i*i<=L;i++){
			if(L%i!=0)continue;
			long j=L/i;
			
			long cnt=1;
			foreach (long k in highest.Keys){
				if(i%highest[k]==0){
					cnt*=(pr[k]+1);
				}
			}
			Total+=cnt;
			
			if(j==i)continue;
			cnt=1;
			foreach (long k in highest.Keys){
				if(j%highest[k]==0){
					cnt*=(pr[k]+1);
				}
			}
			Total+=cnt;
		}
		
		long Ans=(Total-1)/2+1;//(L,L)以外は必ず2回カウントされる
		Console.WriteLine(Ans);
	}
	long L;
	public Sol(long l_){
		L=l_;
	}

	Dictionary<long,long> PrimDec(long A){
	 	Dictionary<long,long> D=new Dictionary<long,long>();
	 	if(A==1)return null;
	 	long rem=A;
	 	for(long i=2;i<=(long)Math.Sqrt((double)A);i++){
	 		if(rem%i==0){
	 			long cnt=0;
	 			while(rem%i==0){cnt++;rem/=i;}
	 			D.Add(i,cnt);
	 		}
	 		if(rem==1)break;
	 	}
	 	if(rem!=1)D.Add(rem,1);
	 	return D;
	}



	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}