WA in MYSARA (March Cookoff)

I am trying to solve thisproblem of march cookoff.I tried to solve after reading the editorialist’s solution but not getting AC.
Here is my program.

Just change your loop to this-

 for(int i=0;i<n-1;i++){
			ll z=__builtin_popcount(b[i]);
            ans*=(1<<z);
            ans%=M;
  }