#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

int power[70];

/*** chmax, chmin ***/
// a < b ならば a を b で更新
// 更新されたら true を返す
template <typename T>
bool chmax(T &a, const T &b) {
	if (a < b) {
		a = b; 
		return true;
	}
	return false;
}
// a > b ならば a を b で更新
// 更新されたら true を返す
template <typename T>
bool chmin(T &a, const T &b) {
	if (a > b) {
		a = b; 
		return true;
	}
	return false;
}
/*** chmax, chmin ここまで ***/

/*** MOD CALCULATION ***/

const int MOD = 1e9+7;
const int MAX = 510000;

ll addM(ll a, ll b){
	return (a + b) % MOD;
}

ll mulM(ll a, ll b){
	ll temp = ((a % MOD) * (b % MOD)) % MOD;
  	while(temp<0){ temp += MOD; }
  	return temp;
}

ll powM(ll a, ll b){
	if(b == 0) return 1;
  	else if(b == 1) return a%MOD;
  	else if(b%2==0) return mulM(powM(a,b/2),powM(a,b/2));
  	else return mulM(a,mulM(powM(a,(b-1)/2),powM(a,(b-1)/2)));
}

// b^{-1} = b^{p-2} (mod p)
// a/b = a*b^{p-2} (mod p)
ll divM(ll a, ll b){ 
  	return mulM(a,powM(b,MOD-2));
}

// n!, (n!)^{-1} のテーブル作成
ll fac[MAX], finv[MAX], inv[MAX];
void COMBinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    rep3(i,2,MAX-1){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COMB(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

/*** MOD CALCULATION ここまで ***/

void setpower(){
	power[0] = 1;
  	rep(i,65) power[i+1] = mulM(power[i],2);
  	return;
}

vi intto2(ll x){
  	// int を 2 進数に変換して反転したものを返す
    // ex) 1 -> 1, 2 -> 01, 3 -> 11, 4 -> 001, ... 
  	vi ans;
	if(x == 0) return {0};
  	while(x!=0){
    	ans.emplace_back(x%2); // 末尾に追加
      	x = (x - (x%2))/2;
    }
  	return ans;
}

void Main()
{
	int n; 
  	cin >> n;
  	vector<ll> a(n);
  	vvi data(n);
	int szmx = 0;
  	rep(i,n) {
      	cin >> a[i];
    	data[i] = intto2(a[i]);
      	chmax(szmx, (int)data[i].size());
    }
  	
  	/*
  	rep(i,n){
  		rep(j,data[i].size()) {cout << data[i][j];}
		cout << endl;      
    }
    */
  
  	// s を固定して data[i][s] の中に 0, 1 がそれぞれいくつあるかを数える
  	vi cntzero(szmx,0);
  	vi cntone(szmx,0);
	vi temp(szmx);  
  	rep(s,szmx){
  		rep(i,n){
          	if(data[i].size()<=s) cntzero[s]++;
    		else if(data[i][s] == 0) cntzero[s]++;
          	else if(data[i][s] == 1) cntone[s]++;
    	}
      	temp[s] = cntzero[s] * cntone[s];
    }
  	setpower();
  	
	// rep(s,szmx) cout << s << ": " << cntzero[s] << ", " << cntone[s] << endl;
  
  	ll ans = 0;
  	rep(s,szmx) {
      	ll a = mulM(power[s],temp[s]);
      	ans = addM(ans,a);
      	// cout << s << ": " << power[s] << ", " << temp[s] << ", " << a << ", " << ans << endl;
    }  	
  	cout << ans << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}