#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
int main() {
  ll n;
  cin >> n;
  ll a[n + 5];
  for (ll i = 0; i < n; i++) cin >> a[i];
  ll sum = 0;
  for (int i = 0; i < 60; i++) {
    ll zc = 0, oc = 0;
    ll unit_sum = 0;
    for (ll j = 0; j < n; j++) {
      if (a[j] % 2 == 0)
        zc++;
      else
        oc++;
      a[j] /= 2;
    }
    unit_sum = ((oc * zc) % mod * (1LL << i) % mod) % mod;
    sum += unit_sum, sum %= mod;
  }
  cout << sum % mod << "\n";
}
