#include <bits/stdc++.h>
using namespace std;
using ll = long long;
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;
}
int main() {
  ll n;
  cin >> n;
  ll a[n];
  vector<vector<ll>> v(n);
  for (int i = 0; i <= n - 1; i++) {
    cin >> a[i];
    ll input = a[i];
    for (int j = 0; j <= 65; j++) {
      if (input > 0) {
        v[i].push_back(input % 2);
        input /= 2;
      } else {
        v[i].push_back(0);
      }
    }
  }
  ll ans = 0;
  const ll MOD = pow(10, 9) + 7;
  for (int i = 0; i <= 60; i++) {
    ll cnt = 0;
    for (int j = 0; j <= n - 1; j++) {
      if (v[j][i] == 1) ++cnt;
    }
    ans += (cnt * (n - cnt) % MOD) * (1LL << i) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}
