#include <bits/stdc++.h>
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
using ld = long double;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main(void) {
  ll N, i, j, A[300001], cnt_0[70] = {0}, cnt_1[70] = {0}, ans = 0;
  cin >> N;
  for (i = 1; i <= N; i++) {
    cin >> A[i];
    j = 1;
    while (A[i] > 0) {
      if (A[i] % 2 == 0)
        cnt_0[j]++;
      else
        cnt_1[j]++;
      A[i] /= 2;
      j++;
    }
  }
  ll sum = cnt_0[1] + cnt_1[1];
  for (i = 1; i <= 60; i++) {
    if (cnt_0[i] > 0 || cnt_1[i] > 0) {
      ans += powl(2, i - 1) * (sum - cnt_1[i]) * cnt_1[i];
    }
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
