#include <stdio.h>

#include <iostream>
#include <vector>
#include <array>

constexpr uint64_t MOD = 1'000'000'007;

int main() {
	int n;

	scanf("%d", &n);

	std::array<int64_t, 62> bits{};
	for (int64_t i = 0; i < n; i++) {
		int64_t d;
		scanf("%ld", &d);
		for (int64_t b = 0; b < 62; b++) {
			bits[b] += !!(d & (1LL << b));
		}
	}

	uint64_t ans = 0;

	for (int64_t b = 0; b < 62; b++) {
		ans += (bits[b]*(n-bits[b])) * ((1LL << b) % MOD);
		ans %= MOD;
	}

	std::cout << ans;
  return 0;
}
