#include<iostream>
#include<sstream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cfloat>
#include<functional>
#include<map>
#include<string>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<bitset>
#include<list>
#include<numeric>
#include<complex>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<long long, long long> ll_ll;
typedef pair<double, double> d_d;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define rep2d(i, j, n) for(i = 0;i < n;++i)for(j = i + 1;j < n;++j)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define sc(x) cin >> x
#define sc2(x, y) cin >> x >> y
#define sc3(x, y, z) cin >> x >> y >> z
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << x << "\n"
#define pri2(x, y) cout << x << " " << y << "\n"
#define pri3(x, y, z) cout << x << " " << y << " " << z << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << x << "\n"
#define debug2(x, y) cout << " --- " << x << " " << y << "\n"
#define debug3(x, y, z) cout << " --- " << x << " " << y << " " << z << "\n"
#define debugn(i, n, a) rep(i, n)cout << " --- " << a[i] << "\n";
#define debugin(i, n, a) rep(i, n)printf(" --- %10d\n", a[i])
#define debugi2n(i, n, a, b) rep(i, n)printf(" --- %10d %10d\n", a[i], b[i])
#define debugiin(i, n, a) rep(i, n)printf(" --- %10d %10d\n", a[i].first, a[i].second)
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)
#define N 25

int a[N] = {1};

bool isin(int set, int x){
  return (set % a[x + 1]) / a[x];
}

ll solve(ll l){
  if(l == 1)return 1;
  ll tmp = l;
  vector<ll> p;

  for(ll i = 2;i * i <= tmp;++i)if(tmp % i == 0){
    p.pb(i);
    tmp /= i;
    --i;
  }
  p.pb(tmp);

  vector<ll_i> lis;
  int cnt = 1, i, j;
  rep(i, p.size()){
    if(i + 1 == p.size() || p[i] != p[i + 1]){
      lis.pb(mp(p[i], cnt));
      cnt = 0;
    }
    ++cnt;
  }

  vector<ll_ll> lis2;
  //1:max 0:notmax
  rep(i, a[lis.size()]){
    tmp = 1;
    rep(j, lis.size())if(!isin(i, j))tmp *= lis[j].Y;
    lis2.pb(mp(i, tmp));
  }

  ll res = 0;
  rep(i, lis2.size())rep(j, lis2.size())if((i | j) == lis2.size() - 1){
    int s1 = i & (~j);
    int s2 = (~i) & j;

    int k, res1 = 1;
    rep(k, lis.size()){
      if(a[k] & s1)res1 *= lis[k].Y;
      if(a[k] & s2)res1 *= lis[k].Y;
    }

    res += res1;
  }

  return (res + 1) / 2;
}

signed main(void){
  int i, j;
  rep1(i, N)a[i] = a[i - 1] + a[i - 1];
  for(int testcase = 0;;testcase++){
    ll l;
    sc(l);
    if(l == 0)break;
    pri(solve(l));


//*/

//*/ break;
  }
  return 0;
}

Measured memory_bytes: 1232