用定理展开后发现就是不能有二进制位前后的情况
可以直接从后往前枚举之前的子集
也跑得过去
不过可以分块优化表示前位为,后维为的子集的方案数
#include<bits/stdc++.h>
using namespace std;
#define re register
#define cs const
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define fi first
#define se second
#define bg begin
cs int RLEN=1<<20|1;
inline char gc(){
static char ibuf[RLEN],*ib,*ob;
(ib==ob)&&(ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
return ib==ob?EOF:*ib++;
}
inline int read(){
char ch=gc();
int res=0;bool f=1;
while(!isdigit(ch))f^=ch=='-',ch=gc();
while(isdigit(ch))res=(res+(res<<2)<<1)+(ch^48),ch=gc();
return f?res:-res;
}
cs int mod=1e9+7;
inline int add(int a,int b){a+=b-mod;return a+(a>>31&mod);}
inline int dec(int a,int b){a-=b;return a+(a>>31&mod);}
inline int mul(int a,int b){return 1ll*a*b%mod;}
inline void Add(int &a,int b){a+=b-mod,a+=a>>31&mod;}
inline void Dec(int &a,int b){a-=b,a+=a>>31&mod;}
inline void Mul(int &a,int b){a=1ll*a*b%mod;}
inline int ksm(int a,int b,int res=1){for(;b;b>>=1,Mul(a,a))(b&1)&&(Mul(res,a),1);return res;}
inline int Inv(int x){return ksm(x,mod-2);}
cs int N=300005;
int pos[N],val[N],f[523][523],n;
int main(){
#ifdef Stargazer
freopen("lx.cpp","r",stdin);
#endif
n=read();
for(int i=1;i<=n;i++)val[i]=read();
for(int i=n;i;i--){
int u=val[i]>>9,v=val[i]&511;
int res=1;
Add(res,f[0][v]);
for(int s=u;s;s=u&(s-1))Add(res,f[s][v]);
for(int s=511^v;s;s=(511^v)&(s-1))Add(f[u][511^s],res);
Add(f[u][511],res);
}
int res=0;
for(int i=0;i<=511;i++)Add(res,f[i][511]);
cout<<dec(res,n)<<'
';
}