1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <time.h>
#include <algorithm>
#include <bitset>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;

// debugging stuff {{{
#ifdef DEBUG
  #define bDebug 1
  #define bDebug2 0
#else
  #define bDebug 0
  #define bDebug2 0
#endif
#define deb(a) #a << "=" << (a) << " "
#ifndef HOME
  #define assert(a) {}
#endif

template<class T> ostream& operator<<(ostream& os, vector<T> v) //{{{
{
  for(int i=0; i<v.size(); i++)
    os << v[i] << " ";
  os << endl;
  return os;
}  //}}}
// }}} end of debugging stuff

//c++11
#define typeof __typeof__

#define array(a, type, count) type *a = (type*)calloc(sizeof(type), count)
#define eps 1e-9
#define eq(a, b) ( (a) > (b) - eps && (a) < (b) + eps )
#define eraseAll(v) v.erase(v.begin(), v.end())
#define fi first
#define rep(i,n) for(long i=0; i<(n); i++)
#define rep2(i,a,b) for(long i=(a); i<=(b); i++)
#define rep2d(i,a,b) for(long i=(a); i>=(b); i--)
#define zeroMem(a) memset(a, 0, sizeof(a))
#define zeroMem2(a, n) memset(a, 0, sizeof(*a) * n)
#define fore(it,L) for(typeof(L.begin()) it=L.begin(); it!=L.end(); it++)
#define eraseAll(v) v.erase(v.begin(), v.end())
#define se second
#define setMin(a,b) { typeof(a) rv = (b); if (rv < a) a = rv; }
#define setMinP(a,b) { typeof(a) rv = (b); \
                       if (rv >= 0 && (a < 0 || rv < a)) a = rv; }
#define setMax(a,b) { typeof(a) rv = (b); if (rv > a) a = rv; } 
#define swap(a,b) { typeof(a) swapVar = a; a = b; b = swapVar; }
#define Int long long

//*********************** SOLUTION    ******************************

vector<long> dzielniki(int x) {
  vector<long> v;
  long a = 2;
  while (a * a <= x) {
    if (x % a == 0) {
      v.push_back(a);
      if (x / a != a)
        v.push_back(x / a);
    }
    a += 1;
  }
  return v;
}

long f2(long k) {
    // k - Liczba, dla ktorej mamy znalezc p + q == k.
    // p + q = p + p * t
    // p > 1, t > 1
    // k = p * (t + 1)
    // k = p * u, u > 2
    // Zwracamy liczbe mozliwych p, q, czyli liczbę możliwych p, t,
    // czyli liczbe mozliwych p, u. Nie ma warunku na to, ktora liczba jest wieksza
    // czy tez rowna, p czy u.
    vector<long> dz = dzielniki(k);
    long r = dz.size();
    if (find(dz.begin(), dz.end(), 2) != dz.end())
      r -= 1;
    //System.err.println("dla k " + k + " r mamy " + r);
    return r;
  }

main ()
{
  cin.sync_with_stdio(false);
  //ifstream cin("0.in");
  cout.sync_with_stdio(false);
  long n;
  cin >> n;
  long x = 0;
  vector<long> dz1 = dzielniki(n);
  dz1.push_back(1);
  fore(it, dz1) {
    if (n % *it != 0)
      continue;
    x += f2(n / *it - 1);
  }
  cout << x << endl;
}