Given is a positive integer N.

We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.

* Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.



In how many choices of K will N become 1 in the end?

Constraints

* 2 \leq N \leq 10^{12}
* N is an integer.

Input

Input is given from Standard Input in the following format:


N


Output

Print the number of choices of K in which N becomes 1 in the end.

Examples

Input

6


Output

3


Input

3141


Output

13


Input

314159265358


Output

9
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) ((int)(x).size())

typedef	long long ll;

bool works(ll n, ll k)
{
	while (n%k==0)
		n/=k;
	return n==1 or n%k==1;
}

int main(void)
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	
	ll N;
	cin >> N;
	ll sol(0);
	for (ll K(1); K*K <= N; ++K)
	{
		if (N%K==0)
		{
			if (K > 1)
				sol += works(N,K);
			if (N/K != K)
				sol += works(N,N/K);
		}
	}
	for (ll K(1); K*K<=N-1; ++K)
	{
		if ((N-1)%K==0)
		{
			sol += K>1;
			if ((N-1)/K != K)
				sol += 1;
		}
	}
	cout << sol << endl;
}

