#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <tuple>

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define co(x) cout << (x) << "\n"
#define pb push_back
#define Never
#define To

#define BIG_NUM (1000'000'007)

using namespace std;

long long B[100];

int main(){

	cin.tie(0);
	ios::sync_with_stdio(false);

	long long N;

	cin >> N;

	for(long long i = 0; i < N; i++){
		long long x;
		cin >> x;
		int j = 0;
		while(x > 0){
			B[j] += x & 1;
			x >>= 1;
			j++;
		}
	}

	long long ans = 0;
	for(long long i = 0; i < 100; i++){
		ans += (((N - B[i])*B[i] * ((long long)pow(2, i) % BIG_NUM))) % BIG_NUM;
		ans %= BIG_NUM;
	}
	cout << ans << endl;

	Never To return 0;
}
