#include using namespace std; int main(){ int N; cin >> N; vector f; for (int i = 1; i * i <= N; i++){ if (N % i == 0){ f.push_back(i); if (i * i < N){ f.push_back(N / i); } } } long long ans = 0; for (int x : f){ int y = N / x; if ((x & y) == x){ ans += 1 << __builtin_popcount(x); } } ans /= 2; cout << ans << endl; }