#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
const long long INF =
    sizeof(long long) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const long long MOD = (long long)1e9 + 7;
const double EPS = 1e-9;
long long modpow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return res;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N;
  long long C[62] = {0};
  cin >> N;
  long long A;
  for (long long i = (0), i_len = (N); i < i_len; i++) {
    cin >> A;
    for (long long j = (0), j_len = (62); j < j_len; j++) {
      if ((A >> j) & 1) C[j]++;
    }
  }
  long long ans = 0;
  for (long long i = (0), i_len = (62); i < i_len; i++) {
    ans = (ans + C[i] * (N - C[i]) * modpow(2, i)) % MOD;
  }
  cout << ans << endl;
  return 0;
}
