#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll mod = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (ll i = 0; i < (n); i++) cin >> a[i];
  ll ans = 0;
  for (ll i = 0; i < (60); i++) {
    ll x = 0;
    for (ll j = 0; j < (n); j++)
      if (a[j] >> i & 1) x++;
    ll memo = 1;
    for (ll j = 0; j < (i); j++) {
      memo *= 2;
      memo %= mod;
    }
    memo *= x;
    memo *= (n - x);
    memo %= mod;
    ans += memo;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
