Problem: 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

Solution (in CPP):

Solution:
//
// Created by yamunaku on 2019/12/29.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

ll modpow(ll x, ll a){
    ll ans = 1;
    while(a){
        if(a & 1) ans = ans * x % MOD;
        a >>= 1;
        x = x * x % MOD;
    }
    return ans;
}

ll inv(ll x){
    return modpow(x, MOD - 2);
}


int main(){
    // CFS;
    int n;
    cin >> n;
    vi a(n);
    int b = 20;
    vi dp(1 << b, 0);
    rep(i, n){
        cin >> a[i];
        dp[a[i]]++;
    }
    rep(i, b){
        rep(j, 1 << b){
            if(j & (1 << i)) dp[j ^ (1 << i)] += dp[j];
        }
    }
    ll ans = modpow(2, n) - 1;
    vl mp(n + 1, 1);
    repl(i, 1, n + 1) mp[i] = mp[i - 1] * 2 % MOD;
    repl(i, 1, 1 << b){
        int c = 0;
        rep(j, b) if(i & (1 << j)) c++;
        ans = (ans + (mp[dp[i]] - 1 + MOD) % MOD * (1 - c % 2 * 2) + MOD) % MOD;
    }
    cout << ans << endl;
    return 0;
}