#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll N;
  cin >> N;
  ll A[N];
  ll mod = 1000000007;
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int bit = 0; bit < 60; bit++) {
    ll one = 0;
    for (int i = 0; i < N; i++) {
      if (A[i] & (1 << bit)) {
        one++;
      }
    }
    ll now = one * (N - one) % mod;
    for (int i = 0; i < bit; i++) {
      now = (now * 2) % mod;
    }
    ans += now;
    ans += mod;
  }
  cout << ans << endl;
  return 0;
}
