#include using namespace std; #define ALL(x) begin(x),end(x) #define rep(i,n) for(int i=0;i<(n);i++) #define debug(v) cout<<#v<<":";for(auto x:v){cout<bool chmax(T &a,const T &b){if(abool chmin(T &a,const T &b){if(b ostream &operator<<(ostream &os,const vector&v){ for(int i=0;i<(int)v.size();i++) os< istream &operator>>(istream &is,vector&v){ for(T &x:v)is>>x; return is; } signed main(){ int n;cin>>n; vector a(n); cin>>a; const int M=(1<<10); vector dp(M,0),ov(M,0); dp[0]=1; for(auto &x:a){ vector ndp(M,0),nov(M,0); rep(i,M){ if(dp[i]){ ndp[i&x]=1; if(i+x>=M) nov[(i+x)%M]+=1; else ndp[i+x]=1; } if(ov[i]){ ndp[i&x]=1; } nov[(i+x)%M]+=ov[i]; } swap(dp,ndp); swap(ov,nov); ll res=0; rep(i,M) res+=dp[i]+ov[i]; cout<