#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
constexpr int mod = 1000000007;

int main() {
	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	ll ans = 0;
	rep(i, 60) {
		ll x = 0;
		rep(j, n) if (a[j] >> i & 1) x++;
		ll tmp = x * (n - x) % mod;
		rep(j, i) {
			tmp *= 2;
			tmp %= mod;
		}
		ans += tmp;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}
