#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  ll ans = 0;
  for (int i = 0; i < (n); i++) cin >> a[i];
  for (int i = 0; i < (60); i++) {
    ll one = 0;
    for (int j = 0; j < (n); j++) {
      if (a[j] >> i & 1) one++;
    }
    ll temp = one * (n - one) % mod;
    for (int j = 0; j < (i); j++) temp *= 2 % mod;
    ans += temp;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
