2
1 31
 2
1 0
 10
450661 128600 993228 725823 293549 33490 843121 903634 556169 448234
 1
1
 5
1 3 5 7 9
 6
524 529 5249 524 529 529
 3
1 2 3
 2
0 1
 55
0 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 3 4 5 6 7 8 9 4 5 6 7 8 9 5 6 7 8 9 6 7 8 9 7 8 9 8 9 9
 16
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
 3
128 1024 2048
 10
3 3 3 5 5 3 3 3 3 5
 1
0
 2
1 2
 2
0 0
 2
1 1

0
 2
 632
 0
 0
 24
 2
 2
 621247139
 64594
 4
 0
 1
 1
 3
 0


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define popb pop_back
#define popf pop_front
#define all(v) v.begin(), v.end()
#define fori(i, j, k) for (int i = (j); i < (int)(k); i++)
#define forb(i, j, k) for (int i = (j); i >= (int)k; i--)
#define lchild(ind) 2 * ind + 1
#define rchild(ind) 2 * ind + 2
#define bug(val) cout << "# " << val << endl;
#define bugs(val) cout << '_' << val;
#define bugl(val) cout << "## " << val << endl;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef pair<int, pll> pip;
typedef pair<ll, pll> plp;
typedef pair<pll, int> ppi;
typedef pair<pll, ll> ppl;
typedef pair<pll, pll> ppp;
typedef vector<int> vi;
typedef vector<ll> vll;

const int maxn = 2e6 + 1, maxb = 21;
const ll inf = 2e18, mod = 1e9 + 7;

int n, a[maxn], dp[maxb][(1 << maxb)];
ll pw[maxn], ans;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	pw[0] = 1;
	fori (i, 1, maxn)
		pw[i] = pw[i - 1] * 2 % mod;

	cin >> n;
	fori (i, 0, n)
	{
		cin >> a[i];
		dp[maxb - 1][a[i]]++;
	}
	int pos;
	forb (i, maxb - 2, 0)
	{
		pos = maxb - 2 - i;
		fori (mask, 0, (1 << maxb))
		{
			if ((mask >> pos) & 1)
				dp[i][mask] = dp[i + 1][mask];
			else
				dp[i][mask] = dp[i + 1][mask] + dp[i + 1][mask | (1 << pos)];
		}
	}
	fori (mask, 0, (1 << maxb))
		ans = (ans + ((__builtin_popcount(mask) & 1) ? -1 : 1) * pw[dp[0][mask]] % mod) % mod;
	cout << ans << endl;
}
