#include <bits/stdc++.h>
using namespace std;
unsigned long long int prime = 1000000000 + 7;
int main() {
  unsigned long long int N;
  cin >> N;
  vector<unsigned long long int> A;
  for (int i = 0; i < N; ++i) {
    unsigned long long int a = 0;
    cin >> a;
    A.push_back(a);
  }
  unsigned long long int val = 0;
  for (int i = 0; i < 62; ++i) {
    unsigned long long int ones = 0;
    for (int j = 0; j < N; ++j) {
      if ((A[j] >> i) & (unsigned long long int)1) {
        ++ones;
      }
    }
    unsigned long long int added_val =
        ((unsigned long long int)ones * (unsigned long long int)(N - ones) *
         ((((unsigned long long int)1) << i) % prime)) %
        prime;
    val += added_val;
    val %= prime;
  }
  cout << val << endl;
}
