#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using ll = long long;
const ll MOD = 1000000007;
const ll INF = 1LL << 60;
int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (int i = 0; i < (int)(N); i++) cin >> A.at(i);
  ll ans = 0;
  for (int i = 0; i < (int)(60); i++) {
    ll n0 = 0, n1 = 0;
    for (int j = 0; j < (int)(N); j++) {
      if (A.at(j) & (1LL << i))
        n1++;
      else
        n0++;
    }
    ans = ((ll)pow(2, i) % MOD * n0 * n1 % MOD + ans) % MOD;
  }
  cout << ans << endl;
}
