#include #pragma GCC optimize("unroll-loops") using namespace std; using std::cout; using std::cin; using std::endl; using ll=long long; const int mod=998244353; #define rep(i,a,b) for (int i=(int)(a);i<(int)(b);i++) #include using namespace atcoder; void solve(); // oddloop int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t=1; //cin>>t; rep(i,0,t) solve(); } void solve(){ using mint=modint998244353; int L=(1<<18); int N; cin>>N; vector A(L); rep(i,0,N){ int a; cin>>a; A[a]++; } vector dp(L); vector fact(L,1),fact_inv(L,1); rep(i,1,L) fact[i]=fact[i-1]*i; fact_inv[L-1]=fact[L-1].inv(); for(int i=L-1;i>0;i--) fact_inv[i-1]=fact_inv[i]*i; mint ans=0; auto f=[&](auto self,int l,int r) -> void { if(l+1==r){ dp[l]+=fact_inv[l]; dp[l]*=(mint(2).pow(A[l])-1); ans+=dp[l]*fact[l]; return; } int m=(l+r)/2; self(self,l,m); vector p(m-l),q(r-l); rep(i,l,m) p[i-l]=dp[i]; rep(i,0,r-l) q[i]=fact_inv[i]; p=convolution(p,q); rep(i,m,r) dp[i]+=p[i-l]; self(self,m,r); }; f(f,0,L); cout<