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>
#define N (1<<20)
#define M 5001
#define R register
#define x first
#define y second
#define ll long long
#define db double
#define mp make_pair
#define pb push_back
#define pi pair<int,int>
#define lb(x) (x&-x)
#define mod 1000000007
#define INF 0x7fffffff
#define F(i,start,end) for(R int (i)=(start);(i)<=(end);i++)
#define T(i,end,start) for(R int (i)=(start);(i)>=(end);i--)
using namespace std;
template<typename T> void read(T &x)
{
	int f=1;
	x=0;
	char c=getchar();
	while(!isdigit(c))
	{
		if(c=='-')
			f=-1;
		c=getchar();
	}
	while(isdigit(c))
	{
		x=(x<<3)+(x<<1)+c-'0';
		c=getchar();
	}
	x*=f;
	return;
}
void write(R ll x)
{
	if(x<0)
	{
		x=~x+1;
		putchar('-');
 	}
	if(x>9)
		write(x/10);
	putchar(x%10+'0');
	return;
}
int n;
ll f[N],g[N],s[N],ans;
ll power(ll x,ll y)
{
	ll ret=1;
	for(;y;y>>=1,x=x*x%mod)
		ret=ret*(y&1?x:1);
	return ret;
}
int count(int x)
{
	int ret=0;
	for(;x;x>>=1)
		ret+=x&1;
	return ret;
}
int main()
{
	read(n);
	F(i,1,n)
	{
		int x;
		read(x);
		f[x]++;
	}
	F(i,0,19)
		T(j,0,N-1)
			if(!(j&(1<<i)))
				(f[j]+=f[j|(1<<i)])%=mod;
	F(i,0,N-1)
		g[i]=(power(2,f[i])-1+mod)%mod;
	F(i,0,N-1)
		s[i]=count(i)&1?-1:1;
	F(i,0,N-1)
		ans=(ans+(s[i]*g[i]%mod+mod)%mod)%mod;
	write(ans);
 	return 0;
}