#include <bits/stdc++.h>
using namespace std;
uint64_t MOD = 1e9 + 7;

int main()
{
  uint64_t N, ans = 0, e = 1;
  cin >> N;
  vector<uint64_t> A(N);
  for (uint64_t i = 0; i < N; i++)
    cin >> A.at(i);
  for (uint64_t i = 0; i <= 60; i++)
  {
    uint64_t one = 0;
    for (uint64_t j = 0; j < N; j++)
      if (A.at(j) & (1LL << i))
        one++;
    ans += ((one * (N - one)) % MOD) * e % MOD;
    e *= 2;
    e %= MOD;
  }
  cout << ans % MOD << endl;
}
