#include "bits/stdc++.h"

//region Template
#include "ext/pb_ds/assoc_container.hpp"

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const int MOD = 1000000007;
using namespace std;
#define finish(x) cout << x; exit(0);
#define fastIO cin.tie(0); cin.sync_with_stdio(false);
#define endl '\n'

void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }

//const string USCAO_TAG = "mountains";
void usaco(const string& USACO_TAG) { setIn(USACO_TAG + ".in"); setOut(USACO_TAG + ".out"); }
void print() {}
template<typename T, typename... Args>
void print(T firstArg, Args... args) {
	#ifdef LOCAL
	cout << firstArg << " ";
	print(args...);
	#endif
}
//endregion

/* Notes:
 * Farah </3
 */

int mx = 0;
const int MAXN = 1e6 + 5;
vector<vector<int>> adj;
bool v[MAXN];
int ans[MAXN];
vector<pair<int, int>> e;

map<pair<int, int>, int> col;

vector<ll> pw { 1 };

ll a[MAXN], cnt[MAXN];
int main() {
	//usaco("milkvisits");

	#ifdef LOCAL
	setIn("in.txt");
	setOut("out.txt");
	#endif

	ll pwt = 2;
	for(int i = 0; i < 60; i++){
		pw.push_back(pwt);
		pwt *= 2;
	}

	ll n;
	cin >> n;


	for(int i = 0; i < n; i++){
		cin >> a[i];

		for(int j = 0; a[i]; j++, a[i] >>= 1){
			if(a[i] & 1ll){
				cnt[j]++;
			}
		}
	}

	//cout << cnt[1] << endl;
	ll ans = 0;
	for(int i = 0; i < 61; i++){
		ans = ans + (n - cnt[i]) * cnt[i] * pw[i];
		ans %= MOD;
	}

	cout << ans;
}