#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#define ll long long
using namespace std;
ll a[300001];
int main(){
	ll n;
	cin>>n;
	map<ll,ll> m;
	for(ll i=0;i<n;i++){
		cin>>a[i];
		m[a[i]]++;
	}
	ll l=m.size();
	ll ans=0;
	ll a1,b1;
	ll af[l][2]={0};
	ll aa=0;
	map<ll,ll>::iterator it;
	for(it=m.begin();it!=m.end();it++){
		af[aa][0]=it->first;
		af[aa][1]=it->second;
		aa++;
	}
	for(int i=0;i<l-1;i++){
		for(int j=i+1;j<l;j++){
			a1=af[i][0];
			b1=af[j][0];
			ans=(ans+((a1^b1)*af[i][1]*af[j][1])%1000000007)%1000000007;
		}
	}
	cout<<ans<<endl;
	return 0;
}