#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long;
const ll MOD = 1e9 + 7;
const int INF = 1e9;
int main() {
  ll N, A;
  cin >> N;
  vector<ll> b(60, 0);
  for (int i = 0; i < N; i++) {
    cin >> A;
    for (int j = 0; j < 60; j++) {
      b[j] += (A >> j) % 2;
    }
  }
  ll ans = 0;
  for (int i = 0; i < 60; i++) {
    ll x = 1 << i;
    x %= MOD;
    x *= b[i];
    x %= MOD;
    x *= N - b[i];
    x %= MOD;
    ans = (ans + x) % MOD;
  }
  cout << ans << endl;
}
