#include<bits/stdc++.h>
using namespace std;

#define x first
#define y second
#define rs resize
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define rep(i,a,b) for(auto i=(a);i!=(b); ++i)
#define REP(i,n) rep(i,0,n)
#define all(v) (v).begin(), (v).end()

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
template<class T> using min_queue = priority_queue<T, vector<T>, greater<T>>;

template<class T1, class T2>
ostream& operator<<(ostream &out, const pair<T1,T2> &a) { return out << '(' << a.x << ", " << a.y << ')'; }
template<class T1, class T2>
istream& operator>>(istream &in, pair<T1,T2> &a) { return in >> a.x >> a.y; }

const int INF = 2147483647;
const ll LLINF = 9223372036854775807LL;

// lambda-expression: [] (args) -> retType { body }

void run() {
	int n;
	cin >> n;

	vector<int> cnt0(64, 0), cnt1(64, 0);

	while (n--) {
		ll x;
		cin >> x;

		REP(i, 64) {
			if (x & 1)
				cnt0[i]++;
			else
				cnt1[i]++;
			x >>= 1;
		}
	}

	const ll mod = 1e9 + 7;
	ll answer = 0;

	ll p2 = 1LL;
	REP(i, 64) {
		answer += p2 * (cnt0[i] * cnt1[i] % mod)
		answer %= mod;
		p2 = (p2 + p2);
		if (p2 >= mod) p2 -= mod;
	}
	cout << answer << endl;

}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cerr << boolalpha;
	(cout << fixed).precision(10);

	run();

	return 0;
}
