#include using namespace std; int main() { int N; cin >> N; long long ret = 0; for (int l = 1; l * l <= N; l++) { int r = N / l; if (r * l == N) { const int AandB = r - l; const int AplusB = AandB + r; const int AxorB = AplusB - AandB * 2; if (AxorB >= 0 and ((AandB & AxorB) == 0)) { int n = __builtin_popcount(AxorB); ret += n ? (1 << (n - 1)) : 1; } } } cout << ret << '\n'; }