#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t mod = pow(10, 9) + 7;
  int64_t N;
  cin >> N;
  vector<int64_t> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  int64_t sum = 0;
  for (int i = 1; i < 60; i++) {
    int64_t p = 0;
    int64_t q = 0;
    for (int j = 0; j < N; j++) {
      if (A[j] & (1ll << i))
        p++;
      else
        q++;
    }
    int64_t tmp = (1ll < i) % mod;
    tmp = tmp * (p * q) % mod;
    sum = (sum + tmp) % mod;
  }
  cout << sum % mod << endl;
}
