#include<bits/stdc++.h>
typedef  long long int ll;
typedef  long double ld;
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define mod 1000000007
#define F first
#define S second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
//recursions\
#pragma comment(linker, "/stack:200000000")
//loops\
#pragma GCC optimize("unroll-loops")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;
int main()
{
	sync;
	ll n;
	cin>>n;
	ll x,cnt[62]={0};
	for(ll i=0;i<n;i++)
	{
		cin>>x;
		for(ll j=0;j<62;j++)
			if(x&(1ll<<j))
				cnt[j]++;
	}
	ll ans=0,mul=1;
	for(ll i=0;i<62;i++)
	{
		ll tot=(n-cnt[i])*cnt[i];
		ans=(ans+(tot*mul)%mod)%mod;
		mul<<=1ll;
	}
	cout<<ans;
}