#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod = 1e9 + 7;
ll modpow(int a, int b) {
  if (!b) return 1;
  if (b % 2) return modpow(a, b - 1) * a % mod;
  ll memo = modpow(a, b / 2);
  return memo * memo % mod;
}
int main() {
  ll N, A[300000];
  cin >> N;
  for (int i(0); i < N; i++) cin >> A[i];
  ll ans(0);
  for (int i(0); i <= 60; i++) {
    ll tmp(0), cnt0(0), cnt1(0);
    for (int j(0); j < N; j++) {
      if (A[j] >> i & 1)
        cnt1++;
      else
        cnt0++;
    }
    tmp = cnt0 * cnt1 * modpow(2, i);
    tmp %= mod;
    ans += tmp;
    ans %= mod;
  }
  cout << ans << endl;
}
