#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
ll M = 1000000007;
ll count(ll v, ll n) {
  ll ret = 0;
  for (int i = 0; i < n; i++) {
    if ((v >> i) & 0x1) {
      ret++;
    }
  }
  return ret;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  vl a(n);
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
  }
  vl cnt(60, 0);
  for (ll i = 0; i < n; i++) {
    for (ll j = 0; j < 60; j++) {
      cnt[j] += (a[i] >> j) & 0x1;
    }
  }
  ll ans = 0;
  for (ll i = 0; i < 60; i++) {
    ans += ((cnt[i] * (n - cnt[i])) << (i % M)) % M;
    ans %= M;
  }
  cout << ans << endl;
  return 0;
}
