#include #include #define int long long #define all(n) n.begin(),n.end() #define rall(n) n.rbegin(),n.rend() #define rep(i, s, n) for (int i = s; i < (int)(n); i++) #define floatset(n) fixed<using vec=vector; templateusing min_queue=priority_queue,greater>; //templateusing pa=pair; using ll = long long; using ld = long double; using pll = pair; using pii = pair; using Graph = vector>; struct Edge1{ll to,cost;}; using WGraph = vec>; struct BellEdge{ll from,to,cost;}; using BGraph=vec; constexpr ll INF = 1e18; constexpr ll mod = 1000000007; constexpr ll MOD = 998244353; constexpr int dx[4]={1,0,-1,0}; constexpr int dy[4]={0,1,0,-1}; //素数判定 O(√N) bool is_prime(ll z){ if(z<2)return 0; bool ok_p = 1; ll sz = sqrt(z); for(ll i = 2;i <= sz;i++)if(z%i==0){ ok_p=0; break; } return ok_p; } //約数個数 O(√N) ll divisor_num(ll a) { ll ans=0; ld a_sqrt = sqrt(a); for(int i=1;i<=a_sqrt;i++){ if(a%i==0){ if(i==a_sqrt)ans++; else ans+=2; } } return ans; } //桁和 O(|N|) ll dig_sum(ll n){ ll r=0; while(n){ r+=n%10; r/=10; } return r; } //約数列挙 O(√N) vec divisor(ll n){ vecr;ll n_sqrt=sqrt(n); for(ll i=1;i<=n_sqrt;i++){ if(i*i==n)r.push_back(i); else if(n%i==0){ r.push_back(i); r.push_back(n/i); } } return r; } //素因数分解 O(√N) map prime_fac(ll n){ mapr; for(int i=2;i*i<=n;i++){ if(n%i!=0)continue; n/=i; int cnt=1; while(n%i==0){ n/=i; cnt++; } r[i]=cnt; } if(n!=1)r[n]=1; return r; } template bool chmin(T&a,T b){return a>b?a=b,true:false;} template bool chmax(T&a,T b){return a vec> rle(T2 s){ vec>r; ll ss=s.size(); pairt={s[0],1}; rep(i,1,ss){ if(s[i-1]==s[i])t.second++; else{ r.emplace_back(t); t={s[i],1}; } } r.emplace_back(t); return r; } void dijkstra(WGraph&g,vec&dist,ll s){ dist[s]=0; min_queue d; d.push({0,s}); while(!d.empty()){ auto[sum,now]=d.top();d.pop(); if(dist[now] void Fill(A (&array)[N], const T &val){ fill( (T*)array, (T*)(array+N), val ); } signed main(){ int N; cin>>N; auto A=divisor(N); int ans=0; for(auto&x:A){ int y=N/x; bool ok=1; //xがorだと考える for(int i=0;i<35;i++){ if(y&(1LL<