#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod = 1000000007;
ll myXOR(ll x, ll y) 
{ 
   return (x | y) & (~x | ~y); 
} 
int main()
{
	ll z,n,sum=0;
	cin>>n;
	vector<ll> v(n);
	for(ll i=0;i<n;i++)
	  {cin>>v[i];}
	for(ll i= 0 ; i<n;i++)
	{
		for(ll j=i+1;j<n+1;j++)
			z = myXOR (v[i] , v[j])
		sum=(((sum%mod)+(z%mod))%mod);
	}
	cout<<sum<<endl;
	return 0;

}