#include <bits/stdc++.h>
using ll = long long;
using namespace std;
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
ll cnt1[61];
int main() {
  ll n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    ll a;
    cin >> a;
    bitset<60> s(a);
    for (int i = 0; i < 60; i++) {
      if (s.test(i)) cnt1[i]++;
    }
  }
  ll kake = 1;
  ll ans = 0;
  for (int i = 0; i < 60; i++) {
    ans += cnt1[i] * (n - cnt1[i]) * kake;
    ans %= MOD;
    kake *= 2;
    kake %= MOD;
  }
  cout << ans << "\n";
  return 0;
}
