#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; set factor; void all_factor(long long n){ factor.clear(); for (long long i = 1; i*i <= n; i++){ if (n % i == 0){ factor.insert(i); factor.insert(n / i); } } } int main(){ long long N, y, ans=0, cnt; cin >> N; all_factor(N); for (auto x : factor){ y = N/x; cnt = 1; for (int i=0; i<=30; i++){ bool f = x>>i & 1LL, g = y>>i & 1LL; if (!f && g) cnt *= 0; else if (f && g) cnt *= 2; } ans += cnt/2; } cout << ans << endl; return 0; }