#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
ll Pow(ll x, ll n) {
  if (n == 0) return 1;
  if (n % 2 == 0)
    return Pow(x * x % mod, n / 2);
  else
    return x * Pow(x, n - 1) % mod;
}
int main() {
  int n;
  cin >> n;
  ll a[n];
  for (int i = 0; i < (int)n; i++) cin >> a[i];
  vector<int> d(64, 0);
  for (int i = 0; i < (int)64; i++) {
    for (int j = 0; j < (int)n; j++) {
      if (a[j] % 2) d[i]++;
      a[j] /= 2;
    }
  }
  ll ans = 0;
  for (int i = 0; i < (int)64; i++) {
    ll q = (d[i] * (n - d[i])) % mod;
    ans = (ans + Pow(2, i) * q) % mod;
  }
  cout << ans << endl;
  return 0;
}
