#include <bits/stdc++.h>
using namespace std;
long long N;
vector<long long> A;
signed main() {
  cin >> N;
  A.resize(N);
  for (long long i = 0; i < N; i++) cin >> A[i];
  vector<long long> bbb(60, 0);
  for (long long b = 0; b < 60; b++) {
    for (long long i = 0; i < N; i++)
      if ((1LL << b) & A[i]) bbb[b]++;
  }
  long long ans = 0;
  for (long long b = 0; b < 60; b++) {
    ans = (ans + (bbb[b] * (N - bbb[b])) * (1LL << b)) % ((long long)1e+9 + 7);
  }
  cout << ans << endl;
}
