#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const ll MOD = 1e9 + 7;
ll power(ll n, ll k) {
  ll ret = 1;
  if (k == 0) {
    return ret;
  }
  for (ll _ = 0; _ < k; _++) {
    ret *= n;
    ret %= MOD;
  }
  return ret;
}
int main() {
  ll N;
  cin >> N;
  vector<bitset<60>> A(N);
  for (ll i = 0; i < N; i++) {
    ll ai;
    cin >> ai;
    A[i] = bitset<60>(ai);
  }
  vector<ll> bits(N, 0);
  for (ll i = 0; i < N; i++) {
    for (ll j = 0; j < 60; j++) {
      bits[j] += A[i][j];
    }
  }
  ll ans = 0;
  for (ll i = 0; i < 60; i++) {
    ll sum = bits[i] * (N - bits[i]) * power(2, i);
    sum %= MOD;
    ans += sum;
    ans %= MOD;
  }
  cout << ans << endl;
}
