#include <bits/stdc++.h>
using namespace std;
long long a, b, c, k, x, i, d[1005][1005], j, m, n, pfs[1000001], y=0, LmAo;
string s, s1;
map<long long, long long>dem;
int dec2bin(long long k) {
string s="";
while(k>0){
    s=char(k%2+48)+s;
    k=k/2;
}
int dem=0;
for(i=0; i<s.size(); i++)
    if (s[i]=='0')
        dem++;
return dem;
}
int main () {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>c;
for(x=1; x<=c; x++){
    cin>>b;
    cout<<"Case #"<<x<<": "<<(long long)(pow(2, dec2bin(b)))<<"\n";
}
return 0;
}
