#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  ll n;
  ll p = 1e9 + 7;
  cin >> n;
  vector<ll> cnt(61, 0);
  for (ll i = 0; i < n; i++) {
    ll a;
    cin >> a;
    ll j = 0;
    while (a >= 1) {
      if (a % 2 == 1) cnt[j]++;
      a /= 2;
      j++;
    }
  }
  ll ans = 0;
  for (ll i = 0; i < 61; i++) {
    ll base = cnt[i] * (n - cnt[i]);
    ans += ((base << i) % p);
    ans %= p;
  }
  cout << ans << endl;
  return 0;
}
