#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
long long b[100] = { 0 }, b1[100] = { 0 };
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		long long a;
		cin >> a;
		for (int j = 0; j < 60; j++) {
			if (a & (long long(1) << j)) {
				b1[j]++;
			}
			else{
				b[j]++;
			}
		}
	}
	long long ans = 0, two = 1;
	for (int k = 0; k < 60; k++) {
		for (int l = 0; l < k; l++) {
			two = two * 2 % 1000000007;
		}
		ans += b[k] * b1[k] * two % 1000000007;
		two = 1;
		ans = ans % 1000000007;
	}
	cout << ans % 1000000007 << endl;
}