#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline void chmin(T1& a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1& a, T2 b) {
  if (a < b) a = b;
}
const long long MOD = 1e9 + 7;
const long long MAX = 200020;
const double pi = acos(-1);
const double EPS = 1e-12;
const long long INF = 2e18;
long long cnt[60];
long long A[300030];
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (long long i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(long long n, long long k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long add(long long x, long long y) {
  x += y;
  if (x >= MOD) return x - MOD;
  return x;
}
long long sub(long long x, long long y) {
  x -= y;
  if (x < 0) return x + MOD;
  return x;
}
long long mult(long long x, long long y) { return (x * y) % MOD; }
long long bin_pow(long long x, long long p) {
  if (p == 0) return 1;
  if (p & 1) return mult(x, bin_pow(x, p - 1));
  return bin_pow(mult(x, x), p / 2);
}
void solve() {
  long long N;
  cin >> N;
  for (long long i = 0; i < N; ++i) {
    cin >> A[i];
    for (long long j = 0; j < 60; ++j) {
      if (A[i] & (1LL << j)) cnt[j]++;
    }
  }
  long long ans = 0;
  for (long long i = 0; i < N; ++i) {
    for (long long j = 0; j < 60; ++j) {
      if (A[i] & (1LL << j)) {
        ans += (1LL << j) * (N - cnt[j]);
        ans %= MOD;
      } else {
        ans += (1LL << j) * cnt[j];
        ans %= MOD;
      }
    }
  }
  ans = mult(ans, bin_pow(2, MOD - 2));
  cout << (ans) << '\n';
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}
