#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n; scanf("%d", &n); std::vector<i64> a(n);
	for(int i = 0; i < n; i++) scanf("%lld", &a[i]);

	i64 ans = 0;
	const int MOD = 1e9 + 7;
	for(int k = 0; k < 60; k++) {
		i64 A = 0, B = 0;
		for(auto v: a) {
			A += (v >> k & 1);
			B += !(v >> k & 1);
		}

		(ans += A * B % MOD * (1LL << k) % MOD) %= MOD;
	}
	
	printf("%lld\n", ans);
	return 0;
}
