#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
constexpr ll Mod = (ll)1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<ll> A(n);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  ll zero[64] = {}, one[64] = {};
  for (int bit = 0; bit < 64; bit++) {
    for (auto &value : A) {
      if (((value >> bit) & 1) == 1) {
        one[bit]++;
      } else {
        zero[bit]++;
      }
    }
  }
  ll ans = 0;
  ll mult = 1;
  for (int bit = 0; bit < 61; bit++) {
    ll count = (zero[bit] * one[bit]) % Mod;
    ans = (ans + (mult * count) % Mod) % Mod;
    mult <<= 1;
  }
  cout << ans << endl;
}
