#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;

ll modpow(ll a,ll n,ll mod){
  if(n == 0) return 1LL;
  if(n % 2 == 0){
    ll d = modpow(a,n/2,mod) % mod;
    return (d*d) % mod;
  }
  return (a % mod) * (modpow(a,n-1,mod) % mod) % mod;
}

int main(){
  ll n; cin >> n;
  vector<ll> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  ll sum = 0;
  ll times = 0;
  while(times < 65){
    ll cnt1 = 0,cnt0 = 0;
    ll b_sum = 0;
    for(int i = 0; i < n; i++){
      if(a[i] % 2 == 1) cnt1++;
      a[i]/=2;
    }
    cnt0 = n-cnt1;
    b_sum = cnt0*cnt1%MOD;
    ll res = modpow(2,times,MOD)*b_sum;
    sum += res%MOD;
    sum %= MOD;
    times++;
  }
  cout << sum << endl;
  return 0;
}

#include <stdio.h>

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

constexpr int64_t MOD = 1'000'000'007;
constexpr int64_t help = 1;

int main() {
	int64_t n;

	std::cin >> n;

	std::array<uint64_t, 62> bits{};
	for (int64_t i = 0; i < n; i++) {
		int64_t d;
		std::cin >> d;
		for (int64_t b = 0; b < 62; b++) {
			bits[b] += !!(d & (help << b));
		}
	}

	int64_t ans = 0;

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

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