The Ghost Type

Here is the link of the above problem i have been trying. Just want to know where i am going wrong with my this code?
using namespace std;
int n;
int getcount(int mask){
if(mask== (1<<(n)-1))
return 1;
int count=0;
for(int i=0;i<n;i++){
for(int j=1; j<=n; j++){
if(!mask&(1<<(j-1)) && (i+1)&(j)==(i+1))
count++ ;
return count;
int main(){



return 0;

please help me with the above one.

Please indent ur code properly instead of just return 0 too hard to read