#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e15;
const ll MOD = 1000000007;
int main() {
  ll N;
  cin >> N;
  ll count[60];
  for (ll i = 0; i < 60; i++) count[i] = 0;
  for (ll i = 0; i < N; i++) {
    ll A;
    cin >> A;
    for (ll j = 0; j < 60; j++)
      if (A & (1LL << j)) count[j]++;
  }
  ll ans = 0;
  for (ll i = 0; i < 60; i++) {
    ans += count[i] * (1LL << i) % MOD * (N - count[i]);
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
