#include using namespace std; int main(){ int N,mod=998244353,count=0,temp,ans=mod/2+1,flg=1,B,cur=0; cin>>N; for(int i=0;i>B; if(B==-1){ ans=(ans<<1)%mod; flg&=count; }else if(!count){ cur^=B; } temp=max(1,N-i-1); while(temp%2==0){ temp>>=1; ++count; } temp=i+1; while(temp%2==0){ temp>>=1; --count; } } if(flg){ ans=(ans<<1)%mod; } cout<<(flg&&!cur?0:ans)<