#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll mod = 1000000007;
const ll INF = 1LL << 60;
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;
}
ll modpow(ll a, ll n) {
  if (!n) return 1;
  ll x = modpow(a, n / 2);
  if (n % 2)
    return (x * x * a) % mod;
  else
    return (x * x) % mod;
}
int main() {
  int n;
  cin >> n;
  int d[60] = {0};
  for (int i = 0; i < n; i++) {
    ll a;
    cin >> a;
    for (int j = 0; j < 60; j++)
      if (a & (1LL << j)) d[j + 1]++;
  }
  ll ans = 0;
  for (int i = 0; i < 60; i++) {
    ans = (ans + d[i] * (n - d[i]) * modpow(2, (i - 1))) % mod;
  }
  cout << ans << endl;
}
