#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (auto& a : A) cin >> a;
  ll ans = 0;
  for (int k = 0; k < 63; k++) {
    int c = 0;
    for (auto a : A)
      if (a >> k & 1) c++;
    ll x = c * (N - c) % 1000000007;
    for (int i = k; i--;) x = x * 2 % 1000000007;
    ans += x;
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
