#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
vector<unsigned long long> A;
int main() {
  unsigned long long N;
  cin >> N;
  unsigned long long keta = 0;
  vector<unsigned long long> one(100, 0);
  for (unsigned long long i = 0; i < N; i++) {
    unsigned long long a;
    cin >> a;
    A.push_back(a);
    if (keta < log2(a) + 1) keta = log2(a) + 1;
    unsigned long long tmp = A[i];
    for (unsigned long long j = 0; j < keta; j++) {
      if (tmp & 1) one[j]++;
      tmp >>= 1;
    }
  }
  unsigned long long ans = 0, p = 1;
  for (unsigned long long i = 0; i < keta; i++) {
    ans = (ans + (p % MOD) * (one[i] % MOD) * (N - one[i]) % MOD) % MOD;
    p = (p * 2) % MOD;
  }
  cout << ans << endl;
  return 0;
}
