#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < (int)(N); i++) cin >> A[i];
  long long mod = 1e9 + 7;
  vector<long long> ones(60, 0);
  auto bits = [&](long long n) {
    int idx = 0;
    while (n >> idx > 0) {
      if ((n >> idx) & 1) ones[idx]++;
      idx++;
    }
  };
  for (long long a : A) bits(a);
  long long ans = 0;
  for (int i = 0; i < (int)(60); i++) {
    ans = (ans + long long((N - ones[i]) * ones[i] * pow(2, i)) % mod) % mod;
  }
  cout << ans << endl;
  return 0;
}
