#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Map = map<string, ll>;
ll MOD = 1000000007;
int main() {
  ll N;
  cin >> N;
  vector<ll> A(N, 0);
  for (ll i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<vector<ll>> B(N, vector<ll>(61, 0));
  for (ll i = 0; i < N; i++) {
    for (ll j = 1; j < 61; j++) {
      if (A[i] & (1LL << j - 1)) B[i][j]++;
    };
  }
  ll ans = 0;
  ll sum = 0;
  ll memo = 0;
  for (ll i = 1; i < 61; i++) {
    sum = 0;
    memo = 0;
    if (B[0][i]) {
      memo++;
    }
    for (ll j = 1; j < N; j++) {
      if (B[j][i]) {
        sum += j - memo;
        memo++;
      } else {
        sum += memo;
      }
      sum %= MOD;
      memo %= MOD;
      ;
    }
    if (i < 40) {
      ans += ((sum % MOD) << i - 1) % MOD;
      ans %= MOD;
    }
    if (i >= 40) {
      ll K = ((sum % MOD) << i - 31) % MOD;
      K %= MOD;
      K *= (1 << 30) % MOD;
      ans += (K % MOD);
      ans %= MOD;
    };
  }
  cout << ans % MOD << endl;
  return 0;
}
