#include <bits/stdc++.h>
using namespace std;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using ll = long long int;
const int MOD = 1000 * 1000 * 1000 + 7;
bool res() {
  ll n;
  cin >> n;
  if (!cin) return false;
  vector<int> digits(62);
  for (int i = 0; i < n; ++i) {
    ll num;
    cin >> num;
    int cont = 0;
    while (num > 0) {
      if (num % 2 == 1) ++digits[cont];
      num /= 2;
      ++cont;
    }
  }
  ll tot = 0;
  for (int i = 0; i < digits.size(); ++i) {
    ll pot = (1LL << i) % MOD;
    tot = (tot + (pot * digits[i] * ((n - digits[i]) % MOD)) % MOD) % MOD;
  }
  cout << tot << '\n';
  return true;
}
int main() {
  while (res()) {
  }
  return 0;
}
