#include <bits/stdc++.h>
using namespace std;
int bitCount(int bit) {
  if (bit == 0) return 0;
  return bitCount(bit >> 1) + (bit & 1);
}
int main(void) {
  const unsigned long long MOD = 1000000007;
  unsigned long long sum = 0;
  unsigned long long N;
  vector<unsigned long long> A;
  cin >> N;
  A.reserve(N + 1);
  for (unsigned long long i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < 60; i++) {
    unsigned long long n0 = 0, n1 = 0;
    for (int j = 0; j < N; j++) {
      if ((A[j] >> i) & 1)
        n1++;
      else
        n0++;
    }
    unsigned long long tmp = n0 * n1 % MOD;
    tmp = tmp * (1ll << i) % MOD;
    sum = (sum + n0 * n1 * (1ll << i)) % MOD;
  }
  cout << sum << endl;
  return 0;
}
