#include <bits/stdc++.h>
using ll = long long;
using namespace std;
const ll mod = 1e9 + 7;
ll a[330000];
int main() {
  ll n, ans = 0, tmp, tmp2;
  cin >> n;
  for (ll i = ll(0); i < ll(n); i++) cin >> a[i];
  for (ll i = ll(0); i < ll(60); i++) {
    tmp = 0, tmp2 = 0;
    ll f = powl((ll)2, i);
    for (ll j = ll(0); j < ll(n); j++) {
      if ((a[j] >> i) & 1)
        tmp++;
      else
        tmp2++;
    }
    ans = (ans + f * tmp * tmp2) % mod;
  }
  cout << ans % mod;
}
