#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag,
		tree_order_statistics_node_update> ordered_set;

#define el				'\n'
#define sz(v)			((int)((v).size()))
#define all(v)          ((v).begin()),((v).end())
#define clr(v, d)		memset(v, d, sizeof(v))

double const EPS = 1e-8, PI = acos(-1);
const int N = 3e5 + 9, M = 1e4 + 9, OO = (int) 2e9 + 1;
const long long MOD = 1e9 + 7, INF = 1e18 + 9;

typedef long long ll;

void OUTPUT() {
	cout << fixed << setprecision(0);
	ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}

void INPUT() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
}

int n;
ll ans, arr[N];
ll zeroCnt[109], binRep[109];

int getBit(ll num, int idx) {
	return ((num >> idx) & 1) == 1;		// 110100, idx = 4  -->  110 & 1 = 0
}

int main() {
//	INPUT();
	OUTPUT();
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> arr[i];
		for (int j = 0; j < 61; j++) {
			if (!getBit(arr[i], j))
				zeroCnt[j]++;
		}
	}

	for (int i = 0; i < 100; i++) {
		ll x = zeroCnt[i] * (n - zeroCnt[i]);
		for (int j = 0; j < 100; j++) {
			if (getBit(x, j)) {
				binRep[j + i]++;
			}
		}
	}

	ll vv = 1;
	for (int i = 0; i < 100; i++) {
		if (binRep[i]) {
//			ans = (ans % MOD + vv % MOD) % MOD;
			ans = (ans % MOD + (vv % MOD * binRep[i] % MOD) % MOD) % MOD;
		}
		vv *= 2;
	}
	cout << ans % MOD << el;

	return 0;

}
