#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < (N); i++) cin >> A[i];
  vector<long long> Ones(61, 0);
  for (int i = 0; i < (N); i++) {
    for (int b = 0; b < (61); b++) {
      if (bitset<61>(A[i])[b] == 1) {
        Ones[b]++;
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < (61); i++) {
    ans += Ones[i] * (N - Ones[i]) * (long long)pow(2, i);
    ans %= (long long)1e9 + 7;
  }
  cout << (long long)ans << endl;
}
