#include <bits/stdc++.h>
using ll = long long;
using namespace std;
const ll mod = 1000000007;
int main() {
  ll n;
  cin >> n;
  vector<ll> zero(62, 0);
  vector<ll> one(62, 0);
  for (ll i = 0; i < n; i++) {
    ll a;
    cin >> a;
    for (ll j = 0; j < 62; j++) {
      if (a % 2 == 0)
        zero[j]++;
      else
        one[j]++;
      a /= 2;
    }
  }
  ll ans = 0;
  ll two = 1;
  for (ll i = 0; i < 62; i++) {
    ll add = (two * zero[i] * one[i]) % mod;
    ans = (ans + add) % mod;
    two = (two * 2) % mod;
  }
  cout << ans << endl;
  return 0;
}
