#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000000 + 7;
int main(void) {
  ll n, sum;
  ll cnt[60][2] = {};
  cin >> n;
  sum = 0;
  for (ll i = 0; i < n; i++) {
    ll num;
    cin >> num;
    ll j = 0;
    while (num > 0ll) {
      if (num % 2ll) cnt[j][1]++;
      num /= 2ll;
      j++;
    }
  }
  for (ll i = 0; i < 60; i++) {
    cnt[i][0] = n - cnt[i][1];
    ll sum_cnt = cnt[i][0] + cnt[i][1];
    ll xor_sum = cnt[i][0] * cnt[i][1] % MOD;
    xor_sum = (xor_sum * (1ll << (i % MOD))) % MOD;
    sum = (sum + xor_sum) % MOD;
  }
  cout << sum << endl;
}
