#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
const ll mod = 1E9 + 7;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  ll sum = 0;
  for (int i = 0; i < (60); i++) {
    ll cnt = 0, rui = pow(2, i);
    for (int j = 0; j < (n); j++) {
      if (a[j] >> i & 1) cnt++;
    }
    cnt *= (n - cnt) % mod;
    sum += (cnt * rui) % mod;
    sum %= mod;
  }
  cout << sum;
}
