#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
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 cnt = 0;
    for (int j = 0; j < (n); ++j) {
      if (a[j] & (1LL << i)) cnt++;
    }
    ll x = cnt * (n - cnt);
    for (int j = 0; j < (i); ++j) {
      x = x * 2 % mod;
    }
    ans += x;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
