#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  ll a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<int> v(60);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 60; j++) {
      if (a[i] >> j & 1) v[j]++;
    }
  }
  ll ans = 0;
  for (int i = 0; i < 60; i++) {
    ll p = (1 << i) % MOD;
    ans += v[i] * (n - v[i]) * p;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
