Zero AND Subsets

Given a multiset of nonnegative integers a_1, a_2, .., a_N.

How many non-empty subsets of this set have a value bitwiseAND of 0?

Find the remainder of the answer divided by 10 ^ 9 + 7.

input


N
a_1 a_2 ... a_N


output

Divide the answer by 10 ^ 9 + 7 and output the remainder.

Constraint

* 1 \ leq N \ leq 10 ^ 5
* 0 \ leq a_i \ leq 2 ^ {20} -1



Input example


6
8 6 9 1 2 1


Output example


51






Example

Input

6
8 6 9 1 2 1


Output

51
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

ll dp[(1<<20)];

ll mod_pow(ll x,ll n){
  ll res=1;
  while(n>0){
    if(n&1) res=res*x%MOD;
    x=x*x%MOD;
    n>>=1;
  }
  return res;
}

int main(){
  int N;
  cin>>N;
  vector<int> A(N);
  rep(i,N) cin>>A[i];

  rep(i,N) dp[A[i]]++;

  for(int k=0;k<20;k++){
    for(int s=0;s<(1<<20);s++){
      if(s&(1<<k));
      else dp[s]+=dp[s^(1<<k)];
    }
  }

  ll ans=0;
  for(int i=1;i<(1<<20);i++){
    int n=0;
    for(int j=0;j<20;j++){
      if(i&(1<<j)) n++;
    }
    if(n%2) ans+=(mod_pow(2,dp[i])-1);
    else ans-=(mod_pow(2,dp[i])-1);
    ans=(ans+MOD)%MOD;
  }

  ll result=mod_pow(2,N)-1-ans;
  result=(result+MOD)%MOD;
  cout<<result<<endl;

  return 0;
}

