#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e+9 + 7;
int main() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  for (ll i = 0; i < N; i++) {
    cin >> A[i];
  }
  ll res = 0;
  for (ll d = 0; d < 60; d++) {
    ll zero = 0;
    ll one = 0;
    for (ll i = 0; i < N; i++) {
      if (A[i] >> d & 1)
        one++;
      else
        zero++;
    }
    ll tmp = (1ll << d) % mod;
    ll n = one * zero * tmp % mod;
    res = (res + n) % mod;
  }
  cout << res << endl;
}
