#include <iostream>

int kolichestvo_sposobov(long N) {
	if (N < 3) return 0;
	if (N == 3) return 1;
	int a = N / 2;
	int b = N - a;
	if (a == b) return 2 * kolichestvo_sposobov(a);
	return kolichestvo_sposobov(a) + kolichestvo_sposobov(b);
}

int main() {

	std::cout << kolichestvo_sposobov(2147483647);
	
	return 0;
}