#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long mod = 1000000007;
  vector<long> a(n);
  for (int i = 0; i < (int)(n); ++i) {
    cin >> a.at(i);
  }
  vector<long> c(60);
  for (int i = 0; i < (int)(60); ++i) {
    for (int j = 0; j < (int)(n); ++j) {
      c.at(i) += a.at(j) % 2;
      a.at(j) /= 2;
    }
  }
  long ans = 0;
  for (int i = 0; i < (int)(60); ++i) {
    ans = (ans + (long)pow(2, i) % mod * (n - c.at(i)) * c.at(i)) % mod;
  }
  cout << ans << endl;
}
