1 #include <bits/stdc++.h> 2 using namespace std; 3 #define LL long long 4 typedef pair<int,int> pii; 5 const int inf = 0x3f3f3f3f; 6 const int N =1e6+10; 7 const int MOD = 1e9+7; 8 #define clc(a,b) memset(a,b,sizeof(a)) 9 const double eps = 1e-8; 10 void fre() {freopen("in.txt","r",stdin);} 11 void freout() {freopen("out.txt","w",stdout);} 12 const int R=10000000,P=1000000007; 13 char buf[R+7],*ptr=buf-1,wb[R+7],*wp=wb; 14 int read(){ 15 int x=0,c=*++ptr; 16 while(c<48)c=*++ptr; 17 while(c>47)x=x*10+c-48,c=*++ptr; 18 return x; 19 } 20 void print(int x){ 21 int stk[13],stp=0; 22 if(!x)*(wp++)=48; 23 while(x)stk[stp++]=x%10+48,x/=10; 24 while(stp)*(wp++)=stk[--stp]; 25 *(wp++)=10; 26 } 27 int cnt[N]; 28 int main(){ 29 int n; 30 fread(buf,1,R,stdin); 31 n=read(); 32 int mx=-inf; 33 for(int i=1;i<=n;i++){ 34 int x; 35 x=read(); 36 cnt[x]++; 37 mx=max(mx,x); 38 } 39 mx=min(1000001,mx); 40 for(int j=20;j>=0;j--){ 41 for(int i=1;i<=mx;i++){ 42 if(i&(1<<j)){ 43 cnt[i-(1<<j)]+=cnt[i]; 44 } 45 } 46 } 47 for(int i=0;i<=1000000;++i)print(cnt[i]); 48 fwrite(wb,1,wp-wb,stdout); 49 return 0; 50 }