#include <bits/stdc++.h>
using namespace std;
const uint64_t MOD = 1e+9 + 7;
const uint64_t K = 64;
int main() {
  uint64_t N;
  cin >> N;
  vector<bitset<K>> A(N);
  for (uint64_t n = 0; n < N; ++n) {
    uint64_t a;
    cin >> a;
    A[n] = bitset<K>(a);
  }
  uint64_t S = 0;
  for (uint64_t k = 0; k < K; ++k) {
    uint64_t count1 = 0;
    for (uint64_t n = 0; n < N; ++n) {
      if (A[n][k]) {
        ++count1;
      }
    }
    uint64_t T = (N - count1) * count1;
    T = (T << k) % MOD;
    S = (S + T) % MOD;
  }
  cout << S << endl;
  return 0;
}
