#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx")
using namespace std;
const long long mod = 1e9 + 7;
long long modpow(long long A, long long B) {
  long long kotae = 1;
  while (B > 0) {
    if (B & 1) kotae = kotae * A % mod;
    A = A * A % mod;
    B >>= 1;
  }
  return kotae;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  long long A[300000];
  for (int i = 0; i < (N); i++) cin >> A[i];
  int kazu[60] = {};
  for (int i = 0; i < (N); i++) {
    for (int j = 0; j < (60); j++) {
      kazu[j] += A[i] >> j & 1;
    }
  }
  long long kotae[60] = {};
  for (int i = 0; i < (N); i++) {
    for (int j = 0; j < (60); j++) {
      kazu[j] -= A[i] >> j & 1;
    }
    for (int j = 0; j < (60); j++) {
      if (A[i] >> j & 1) {
        kotae[j] += N - 1 - kazu[j];
      } else {
        kotae[j] += kazu[j];
      }
    }
    for (int j = 0; j < (60); j++) {
      kazu[j] += A[i] >> j & 1;
    }
  }
  long long ans = 0;
  for (int i = 0; i < (60); i++) {
    kotae[i] %= mod;
    long long tmp = (1ll << i) % mod;
    ans += kotae[i] * tmp % mod;
  }
  cout << (ans * modpow(2, mod - 2) % mod) << "\n";
  return 0;
}
