#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll mod = 1e9 + 7;
int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < (n); ++i) cin >> a.at(i);
  ll m(0);
  for (int i = 0; i < (60); ++i) {
    ll x1(0);
    for (int j = 0; j < (n); ++j)
      if ((a.at(j) >> i) & 1) x1++;
    ll x0(n - x1);
    ll p = 1;
    for (int j = 0; j < (i); ++j) {
      p *= 2;
      p %= mod;
    }
    ll c = x0 * x1;
    m += (p * c);
    m %= mod;
  }
  cout << m << endl;
  return 0;
}
