#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  int N;
  long long r = 0;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < (N); ++i) cin >> A.at(i);
  for (int i = 0; i < (60); ++i) {
    int c0 = 0, c1 = 0;
    for (int j = 0; j < (N); ++j) {
      if ((A.at(j) >> i) & 1)
        c1++;
      else
        c0++;
    }
    r += ((1ll << i) % MOD * (c0 * c1) % MOD) % MOD;
  }
  cout << r % MOD << endl;
}
