#include<bits/stdc++.h> using namespace std; int ss(int n){ int i,x=0,y=0,z; while(n!=0){ i=n%2; if(i==1){ x++; }else{ y++; } n/=2; } if(x>y){ return 1; }else{ return 0; } } int main() { int n,i,a=0,b=0; cin>>n; for(i=1;i<=n;i++){ if(ss(i)){ a++; }else{ b++; } } cout<<a<<" "<<b; return 0; } /************************************************************** Problem: 1141 User: zzz Language: C++ Result: Accepted Time:15 ms Memory:2072 kb ****************************************************************/