#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<fstream>
#include<stdlib.h>
#include<set>
#include<climits>
#include<cmath>  
#include<memory.h> 
#include<sstream>
#include<time.h>
#include<iomanip>
using namespace std;
const unsigned long long BIGEST=1000000000000000000+1000000000000000000;
const long long BIGER=1000000000000000000;
const int BIG=1000000000;
const long long MOD=19961993;
const long long LMOD=1000000007;
//const long long LMOD=1000000007;
#define Fi first
#define Se second
#define P2 pair
#define Pii pair<int,int>
#define Pll pair<long long,long long>
#define Cb make_pair
#define ll long long
#define Ull unsigned long long
#define Sf scanf
#define Pf printf
#define Pb push_back
#define Psh push
#define Stc stack
#define Vct vector
#define Ret return
#define Re0 return 0
#define Sz size
#define Is insert
#define Que queue
#define Emp empty
#define Fro front
#define Rv reverse
#define Er erase
#define Bg begin
#define Srt sort
#define Pq priority_queue
#define Ins insert
#define Ite iterator
#define Cou count
#define Cot continue
#define Beg begin
ll a[300001];
int main()
{
	ll n;
	Sf("%lld",&n);
	for(ll i=1;i<=n;i++)
	{
		Sf("%lld",&a[i]);
	}
	ll s=0;
	ll g=0;
	for(ll i=0;i<60;i++)
	{
		g=0;
		for(ll j=1;j<=n;j++)
		{
			//g+=(a[j]>>i)&1ll;
		}
		for(ll j=1;j<=n;j++)
		{
			//if(((a[j]>>i)&1ll))(s+=((1ll<<i)%LMOD)*(n-g))%=LMOD;
			else (s+=((1ll<<i)%LMOD)*g)%=LMOD;
		}
	}
	cout<<(s*((LMOD+1)/2))%LMOD;
	return 0;
}