#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<ll> A(N, 0);
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  ll P = 1;
  for (ll bit = 0; bit < 60; bit++) {
    ll s = 0, t = 0;
    for (int i = 0; i < N; i++) {
      if ((A[i] & P) > 0) {
        s++;
      } else {
        t++;
      }
    }
    ans += (s * t % MOD * P % MOD);
    ans %= MOD;
    P = P * 2;
  }
  cout << ans << endl;
}
