#include<stdio.h>
typedef long long int ll;
int main() {
	ll n;
	scanf("%lld", &n);
	int sosuu[1000000];
	int c = 0;
	int yakusuu[1000000];
	int q = 0;
	for (int i = 2; i < 100000; i++) {
		int k=0;
		for (int j = 1; j <= i / 2; j++) {
			int p;
			p = i % j;
			if (p == 0) {
				k = k + 1;
			}
		}
		if (k == 1) {
			sosuu[c] = i;
			c = c + 1;
		}
	}
	for (int i; i <= c; i++) {
		while (1) {
			int y = n;
			y = y / sosuu[i];
			if (y % sosuu[i] == 0) {
				yakusuu[q] = sosuu[i];
				q = q + 1;
			}
			else{
				break;
			}
		}
	}
	int tate=1;
	int yoko=1;
	for (int i = 0; i <= q; i = i + 2) {
		tate = tate * yakusuu[i];
	}
	tate = tate - 1;
	for (int i = 1; i <= q; i = i + 2) {
		yoko = yoko * yakusuu[i];
	}
	yoko = yoko - 1;
	int kotae = tate  yoko;
	printf("%d", kotae);
	return 0;
}
