#include #include #include using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 4000000000000000001 int main(){ int n; cin>>n; vector a(n); rep(i,n)cin>>a[i]; vector> mp; mp.emplace_back(a[0],1); for(int i=1;i> nmp; for(auto b:mp)nmp.emplace_back(b.first|a[i],0LL); sort(nmp.begin(),nmp.end()); nmp.erase(unique(nmp.begin(),nmp.end()),nmp.end()); if(binary_search(nmp.begin(),nmp.end(),make_pair(a[i],0LL))){ nmp.erase(find(nmp.begin(),nmp.end(),make_pair(a[i],0LL))); } for(auto b:mp){ for(auto &c:nmp){ bool f = false; for(auto d:mp){ if((a[i] | d.first) == c.first && (b.first | d.first) == b.first){ f = true; break; } } if(f){ c.second += b.second; c.second %= 998244353; } } } nmp.insert(nmp.begin(),make_pair(a[i],0)); for(auto b:mp){ nmp[0].second += b.second; nmp[0].second %= 998244353; } swap(mp,nmp); } mint ans = 0; for(auto b:mp)ans += b.second; cout<