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