#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll M = 1000000007;
int main() {
  vector<ll> count(60, 0);
  ll N;
  cin >> N;
  for (ll i = 0; i < N; i++) {
    ll a;
    cin >> a;
    for (ll j = 0; j < 60; j++) {
      count[j] += (a >> j) & 1;
    }
  }
  ll a = 0;
  for (ll i = 0; i < 60; i++) {
    ll t = (((1LL << i) % M) * ((count[i]) * (N - count[i])) % M) % M;
    a = (a + t) % M;
  }
  cout << a << endl;
}
