// copied by Nurstan Duisengaliev
// skatal
#include <bits/stdc++.h>
 
#define ll long long
#define all(x) x.begin(), x.end()
#define in insert
#define mp make_pair
#define F first
#define S second
#define ppf pop_front
#define pb push_back
#define ppb pop_back
#define pf push_front
#define pii pair <int, int>
#define boost() ios_base::sync_with_stdio(0), cin.tie(0)
#define sz(x) x.size()
#define int ll 
using namespace std;
 
const int N = (int)2e5 + 123;
const int mod = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
ll a[N];
ll cnt[100][3];
void solve () {
	int n;
	cin >> n;
	ll ans = 0;
	for (int i = 1; i <= n; i ++) cin >> a[i];
	for (int i = 1; i <= n; i ++) {
		for (int j = 0; j <= 60; j ++) {
			if ((a[i] & (1ll << j)) == 0) {  
			    
				ans += ((cnt[j][1] * ((1ll << j) % mod)) % mod);
			 	ans %= mod;
			 	cnt[j][0] ++;
			}
			else {
			 	ans += ((cnt[j][0] * ((1ll << j) % mod)) % mod);
			 	ans %= mod;
			 	cnt[j][1] ++;
			}
						 
		}
	}
	cout << ans;
}           
 
main () {
//	freopen (".in", "r", stdin);
//	freopen (".out", "w", stdout);
	boost ();
	int TT = 1;
//  cin >> TT;
	while (TT --) {
		solve ();
	}
	return 0;	
}