#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long mod = 1e9 + 7;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
using pll = pair<ll, ll>;
int main() {
  int n;
  cin >> n;
  vector<ll> A(n), cou(62, 0);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < 61; i++) {
    for (int j = 0; j < n; i++) {
      cou[i] += ((A[j] & (1LL << i)) ? 1 : 0);
    }
  }
  ll ans = 0;
  for (int i = 0; i < 61; i++) {
    ll a, b;
    a = cou[i];
    b = n - cou[i];
    (ans += ((a * b) * 1LL << i) % mod) %= mod;
  }
  cout << ans << endl;
  ;
}
