#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll

#define FOR(i,m,n) for(ll i=(m);i<(n);++i)
typedef vector<int> vi;
inline int in() { int x; cin >> x; return x; }
const int MOD = 1000000007;

void solve() {
	int n = in();
	vi v(n); for (auto &i : v) i = in();
	FOR(i,0,60) {
		int odd = 0, even = 0;
		for (auto j : v) (((j >> i) & 1) ? odd : even)++;
		k = (int)1 << i;
		k %= MOD;
		k *= (odd * even) % MOD;
		m += k;
		m %= MOD;
	}
	cout << m << endl;
}

#undef int
int main() {
  solve();
  return 0;
}
