#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]; map mp; mp[a[0]] = 1; for(int i=1;i nmp; for(auto b:mp)nmp[b.first|a[i]] = 0; if(nmp.count(a[i]))nmp.erase(a[i]); 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){ nmp[c.first] += b.second; } } } for(auto b:mp)nmp[a[i]] += b.second; swap(mp,nmp); } mint ans = 0; for(auto b:mp)ans += b.second; cout<