#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;
ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
const ll INF = 1LL << 50;
int main() {
  cout << fixed << setprecision(15);
  ll n;
  cin >> n;
  ll kmax = 61;
  vll c0s(kmax, 0);
  for (ll i = 0; i < (n); ++i) {
    ll a;
    cin >> a;
    for (ll j = 0; j < (kmax); ++j) {
      c0s[j] += a % 2;
      a >>= 1;
    }
  }
  ll const mod = 1000000007;
  ll ans = 0;
  ll rui = 1;
  for (ll j = 0; j < (kmax); ++j) {
    ll c0 = c0s[j], c1 = n - c0s[j];
    ll add = ((c0 * c1) % mod * rui) % mod;
    ans += add;
    ans %= mod;
    rui <<= 1;
  }
  cout << ans << endl;
  return 0;
}
