#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)
#define MOD 1000000007;

using namespace std;
using namespace __gnu_pbds;
//typedef tree<TYPE, null_type, less<TYPE>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
//typedef tree<TYPE, null_type, less_equal<TYPE>, rb_tree_tag, tree_order_statistics_node_update> indexed_multiset;

int n;
long long cnt[61][2];

void decompose(long long var){
	for(int i = 60; i >= 0; i--)
		if((long long)1 << i <= var)
			cnt[i][1]++, var -= (long long)1 << i;
		else cnt[i][0]++;
}

int main(){
	//IO("input.txt", "output.txt");
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	for(int i = 0; i < n; i++){
		long long a;
		cin >> a;
		decompose(a);
	}
	long long sum = 0;
	for(int i = 0; i <= 60; i++){
		sum += (cnt[i][0] * cnt[i][1]) * ((long long)1 << i);
		sum %= (long long)MOD;
	}
	cout << sum << "\n";
	return 0;
}