#include using namespace std; #include using namespace atcoder; using mint=modint998244353; //1000000007; using ll=long long; using pp=pair; #define sr string #define vc vector #define fi first #define se second #define rep(i,n) for(int i=0;i<(int)n;i++) #define pb push_back #define all(v) v.begin(),v.end() #define pque priority_queue #define bpc(a) __builtin_popcount(a) int main(){ int n;cin>>n; sets; rep(i,n){ int a;cin>>a; s.insert(a); } vcv; for(auto au:s)v.pb(au); int t=30; vcbo(t,false); auto f=[&](auto f,int a,vcx)->void{ if(a==-1)return; vcz,o; for(auto au:x){ if(au>>a&1)o.pb(au); else z.pb(au); } if(o.size()&&z.size())bo[a]=true; if((int)z.size()>1)f(f,a-1,z); if((int)o.size()>1)f(f,a-1,o); return; }; f(f,t-1,v); int k=0; rep(i,t)if(bo[i])k++; mint ans=mint(2).pow(k); cout<