#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
ll modpow(ll m, ll n) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return modpow(m * m % MOD, n / 2);
  else {
    return modpow(m, n - 1) * m % MOD;
  }
}
signed main() {
  long long n;
  scanf("%lld", &n);
  vector<ll> a(n);
  for (long long i = 0; i < n; i++) scanf("%lld", &a[i]);
  vector<long long> data(61, 0);
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j <= 60; j++) {
      if (a[i] & (1LL << j)) data[j]++;
    }
  }
  ll ans = 0;
  for (long long i = 0; i <= 60; i++) {
    (ans += data[i] * (n - data[i]) * modpow(2, i)) %= MOD;
  }
  printf("%lld\n", ans);
}
