#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
static const int MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<int> B(60, 0);
  for (int i = 0; i < N; i++) {
    ll a = A[i];
    int bit = 0;
    while (a > 0) {
      B[bit] += a % 2;
      a = a / 2;
      bit++;
    }
  }
  ll ans = 0, n2 = 1;
  for (int i = 0; i < 60; i++) {
    ll addx = (((n2 * B[i]) % MOD) * (N - B[i])) % MOD;
    ans += addx;
    ans %= MOD;
    n2 *= 2;
    n2 % MOD;
  }
  cout << ans << endl;
  return 0;
}
